Re: [geotk] début, installation

Didier CREST didier.crest at imerir.com
Fri Apr 16 09:25:34 EDT 2010


Hello,

I tried to used the example of M.Sorel but Eclipse says that the constructor
of WebMapServer(URL, WMSVersion) is not defined. But I saw in the library
and the Constructor is in. So I don't understand why it doesn't work.


> package wms;
>
> import java.net.URL;
>
> import org.geotoolkit.gui.swing.go2.JMap2DFrame;
> import org.geotoolkit.map.MapBuilder;
> import org.geotoolkit.map.MapContext;
> import org.geotoolkit.referencing.crs.DefaultGeographicCRS;
> import org.geotoolkit.wms.WebMapServer;
> import org.geotoolkit.wms.map.WMSMapLayer;
> import org.geotoolkit.wms.xml.WMSVersion;
> public class TWMS {
>
>
  public static void main(String[] args) {
>
>   MapContext lMapContext =
> MapBuilder.createContext(DefaultGeographicCRS.WGS84);
>   URL serverURL = new URL("
> http://localhost/cgi-bin/mapserv.exe?map=toto&REQUEST=getcapabilities");
>
//Error on this line the constructor is not defined

>   WebMapServer lWMS = WebMapServer(serverURL, WMSVersion.v111);
>   //FeatureTypeBuilder lFeature = new FeatureTypeBuilder();
>   WMSMapLayer lWmsMapLayer = new WMSMapLayer(lWMS, "sr57_depare");
>   lMapContext.layers().add(lWmsMapLayer);
>
>   JMap2DFrame.show(lMapContext);
>
>
>  }
> }
>
>
Sorry for my English and thanks to help me.

Toshy

Le 15 avril 2010 15:10, johann sorel <johann.sorel at geomatys.fr> a écrit :

> Hello,
>
> I dont have the geotoolkit code in front of me (holidays) so the following
> guide might be a bit abstract but should help you.
>
> Every default map objects are created by using the MapBuilder utility
> class.
> MapContext context =  MapBuilder.createContext(DefaultGeographicCRS.WGS84);
> The coordinate reference system provided here will only be used when you
> call getEnvelope
> on the context, it is not used at rendering time.
>
> The SimpleFeatureTypeBuilder doesn't exist anymore in the latest code, it's
> replaced by FeatureTypeBuilder.
>
>
> To add a WMS layer you must first create a server :
> WebMapServer wmsServer = WebMapServer(serverURL,version)
> Then a layer :
> WMSMapLayer wmsLayer = new WMSMapLayer(wmsServer, "layerName");
>
> Add it in the MapContext and that's it.
> context.layers().add(wmsLayer);
>
> TIP 1 : to quickly verify a MapContext, you can use
> JMap2DFrame.show(context);
> This will display a complete frame, with several map tools, tree, style
> editor ... and so on.
> TIP 2 : to render mapcontext as an image use the class
> DefaultPortrayalService
>
> http://pending.geotoolkit.org/apidocs/org/geotoolkit/display2d/service/DefaultPortrayalService.html
> TIP 3 : the swing map widget class is JMap2D .
>
>
> We currently don't have much tutorial nor javadoc in geotk-pending so if
> you have ideas for tutorial
> feel free to send them on the mailing list.
>
> johann sorel (in holidays)
>
>
>
> Martin Desruisseaux a écrit :
>
> Hello Didier, and welcome!
>>
>> Since the Geotoolkit project tries to reach an international user bases,
>> the mails need to be in English. No worry, I will summarize your question.
>>
>> In short, Didier downloaded geotk-bundle.pack.gz, unpacked it and have
>> been able to run the Plot2D widget, but not the more elaborated widgets
>> based on MapContext, SingleFeatureTypeBuilder, etc.
>>
>> This is normal since geotk-bundle.pack.gz contains only the stable part of
>> Geotk. The MapContext and other classes live in the pending part for now.
>> You can download a bundle which contains everything (both the stable and
>> pending parts with all there dependencies) there:
>>
>>    http://hudson.geomatys.com/job/Geotoolkit-pending/
>>
>> This remind me that I need to provide a link on the Geotk web page...
>>
>> The second question that Didier asks is: is it possible to use data from a
>> WMS server with Geotk? The answer is yes, using the geotk-client-wms module
>> (included in the above-cited pack). However in order to get an example about
>> how to use them, we need to hope that Johan Sorel read his email during his
>> holiday :) (he is in holiday right now).
>>
>> A third issue raised by Didier is that the demo applet don't work in his
>> browser. This is a know issue that I need to fix; things are made more
>> difficult by the fact that I'm developing on a Mac platform, and applet
>> behavior seems to change more than standard Java applications between
>> browsers.
>>
>>    Regards,
>>
>>        Martin
>> _______________________________________________
>> Geotoolkit mailing list
>> Geotoolkit at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/geotoolkit
>>
>>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geotoolkit/attachments/20100416/ac10d328/attachment.html


More information about the Geotoolkit mailing list