Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Adding layers from code

Johan C. de Koning wrote:

Hello,

How could I add layers to the map programmatically? Just like the url’s (with parameters) inside I umap file are stored, I want these like of urls to one or more layers from the code to a map. I looked at the code how a project is opened, but I was wondering if this could also be done without using the different Project classes.

So for example I have an url for a WMS server (with layers specified) I want to add these to a map without defining that I am going to add WMS layers (or use the catalog.wms classes). It should be done by the catalog. I found the code inside the UDIG Developers Guide about creating a map from the code, but using a GeoResource adds all the layers from a url (which I don’t).

Yes, the catalog has a lookup function that will basically figure out the best match for your url (you never have to notice if it was based on a WMS or WFS or shapefile).

For an example of this in action please review the code for loading and save OWS Context documents.

Hopefully somebody can give me a little piece of example code about how to get this working.

The programmers guide (included with your default uDig install or on the webstite) should be a help here - Look in the GIS Platform section on how to get a hold of georesources without knowing before hand what type they are. From there you can follow the example you have already found.
Jody



Back to the top