World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 08-10-2012, 10:51 AM   #1
Anthra
Junior Member
 
Join Date: Jun 2011
Location: Liège, Belgium
Posts: 18
Anthra is on a distinguished road
Default Best way to save a WMS layer after loading it

Hi,

I load some layers from WMS server and I use the technic of WMSLayerManager (Getting capabilities and then call a factory to make a layer of it).

This works fine but I'm at a point where I want to make these layers persistent between two usages of my application.

I was wondering if there is a way already defined to save a layer (converting properties needed under an xml or something like that). If not, what should be saved? Only capabilities?

For now I'm just saving layer name and server URI but then I need network to get all capabilities. The problem is that I want these layers to work offline using cache and I can't build the layer without all capabilities.

So can you give me some advice or way of research for me to make the job?

Thanks in advance,

Anthra
Anthra is offline   Reply With Quote
Old 08-10-2012, 11:27 AM   #2
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,623
nlneilson is on a distinguished road
Default

Take one of the WMS layers in the SDK and modify it for the data you want.
It's a bit complicated to code just starting.

The data needs to be installed in your cache Also their is a read and write location, usually the same but the write is checked first then the read, if the data is not found then it will hit a server.

Start with a layer that works.
__________________
Neil
http://www.nlneilson.com

Last edited by nlneilson; 08-14-2012 at 11:09 AM. Reason: typo
nlneilson is offline   Reply With Quote
Old 08-10-2012, 02:23 PM   #3
Anthra
Junior Member
 
Join Date: Jun 2011
Location: Liège, Belgium
Posts: 18
Anthra is on a distinguished road
Default

Thanks for your advices.

After some further investigations and test I can generate the XML, at least partially doing this:
Code:
WMSCapabilities wmsc = defaultListModel.get(i).getCaps();
AVList params = defaultListModel.get(i).getParams();
                    
String[] formatOrderPreference = new String[]
{
    "image/dds", "image/png", "image/jpeg"
};
AVList configParams = DataConfigurationUtils.getWMSLayerConfigParams(wmsc, formatOrderPreference, params);

Document doc = WMSTiledImageLayer.createTiledImageLayerConfigDocument(configParams);
try {
    printDocument(doc, System.out);
} catch (IOException ex) {
    ...
} catch (TransformerException ex) {
    ...
}
That produce the following document:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Layer layerType="TiledImageLayer" version="1">
    <DisplayName>Ortofotografía Rigurosa Color de Andalucía 2008-2009</DisplayName>
    <DatasetName>OCA10_2009</DatasetName>
    <DataCacheName>www.ideandalucia.es\_wms_ortofoto2009\OCA10_2009</DataCacheName>
    <Service serviceName="OGC:WMS">
        <URL>http://www.ideandalucia.es/wms/ortofoto2009?service=wms&amp;</URL>
    </Service>
    <Sector>
        <SouthWest>
            <LatLon latitude="35.9471" longitude="-7.58724" units="degrees"/>
        </SouthWest>
        <NorthEast>
            <LatLon latitude="38.7485" longitude="-1.60187" units="degrees"/>
        </NorthEast>
    </Sector>
    <ImageFormat>image/jpeg</ImageFormat>
</Layer>
I've not tested yet to use this document, I'll give you update of progress.
Anthra is offline   Reply With Quote
Old 08-13-2012, 07:41 PM   #4
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,033
tag is on a distinguished road
Default

TiledImageLayer implements Restorable. Will that help you?
tag is offline   Reply With Quote
Old 08-14-2012, 08:16 AM   #5
Anthra
Junior Member
 
Join Date: Jun 2011
Location: Liège, Belgium
Posts: 18
Anthra is on a distinguished road
Default

I didn't think about that, I'll give it a try. Thx tag.

For the begin of solution I gave, that's not fully correct, for example layer name is stored in DatasetName so when rebuilding the layer and when the request is build the layername is not found.
Anthra is offline   Reply With Quote
Old 08-14-2012, 08:49 AM   #6
Anthra
Junior Member
 
Join Date: Jun 2011
Location: Liège, Belgium
Posts: 18
Anthra is on a distinguished road
Default

It works like a charm! I never did take a look a this mechanism, that is simple and powerful! Thanks a lot for your help.
Anthra is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQUID configuration to cache WMS server responses garakl Server Discussion 1 08-08-2011 02:16 PM
set zoom in level for wms layer in wwj jalwan Development Help 1 04-01-2010 02:54 PM
WMS Layer for the online ArcGIS WMS jgib Development Help 1 03-25-2010 09:52 AM
WW1.3.2-Plugin: Layer Edit canosso Add-ons & Scripts 21 02-27-2010 04:37 AM
How to install NASA World Wind WMS server garakl Server Discussion 0 01-26-2010 10:14 AM


All times are GMT +1. The time now is 02:16 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.