[geotk] Display a WGS84 shapefile with GeoTk

sorel johann.sorel at geomatys.fr
Thu Jun 24 11:59:08 EDT 2010


Hello,

The J2DMapFrame does not zoom to the layer directly,
he starts on the Identity objective to display transform.

You have to use the zoom all button in the toolbar or the zoom to layer 
on the layer properties.


Johann Sorel (Eclesia)



Riou Yvan N2A (DAS SDMOL SCTIG) wrote:
> Good Morning Vincent,
>  
> Some days ago, on georezo.net, I asked you some questions about using 
> GeoToolkit : thanks again for your answers :-)
>  
> Because I have not Internet direct access, I downloaded the pending 
> snapshot package geotk-bundle-pending-SNAPSHOT.pack.gz 
> <http://hudson.geomatys.com/job/Geotoolkit-pending/lastSuccessfulBuild/artifact/target/bundles/geotk-bundle-pending-SNAPSHOT.pack.gz> at 
>  http://download.geotoolkit.org/SNAPSHOT/
>  
> Now, I'm experimenting GeoTk within an Eclipse Java project and 
> presently trying to display some WGS84 data stored in a shapefile that 
> I'm using elsewhere. Here is the code I found (thanks to Eclesia on 
> http://www.developpez.net <http://www.developpez.net/>) :
>  
>  
>
> MapContext pMapCntx = 
> MapBuilder./createContext/(DefaultGeographicCRS./WGS84/);
>
> URL pURL = *new* URL("file:///D:\\CIE.shp");
>
> DataStore pDS = DataStoreFinder./getDataStore/("url",pURL);
>
> Name pName = pDS.getNames().iterator().next();
>
> FeatureCollection pFC = 
> pDS.createSession(*true*).getFeatureCollection(QueryBuilder./all/(pName));
>
> System./out/.println(pFC.size());
>
> MapLayer pLayer = MapBuilder./createFeatureLayer/(pFC, 
> RandomStyleFactory./createDefaultVectorStyle/(pFC));
>
> pMapCntx.layers().add(pLayer);
>
> JMap2DFrame./show/(pMapCntx);
>
>  
>
> The code executes without any error, a java window renderer appears 
> with cartographic elements (scale bar, ...) and a table of contents 
> but nothing is displayd in the view frame : Do you have any idea about 
> what I did wrong ?
>
> Thanks for your help,
>
>  
> S.A. Yvan RIOU
> chef du groupe Cartographie
> CTGN/SDML
> 1 boulevard Théophile Sueur
> 93111 Rosny-sous-Bois
> tél: 01 58 66 57 10
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geotoolkit



More information about the Geotoolkit mailing list