[geotk] Still cannot display my shapefile

sorel johann.sorel at geomatys.fr
Fri Jun 25 10:09:39 EDT 2010


It works perfectly for me.

Snapshot :
http://img694.imageshack.us/img694/9923/testshape.png

DataSet :
ftp://ftp-developpez.com/jsorel/temp/world.zip

Code :
import java.net.URL;
import org.geotoolkit.data.DataStore;
import org.geotoolkit.data.DataStoreFinder;
import org.geotoolkit.data.FeatureCollection;
import org.geotoolkit.data.query.QueryBuilder;
import org.geotoolkit.gui.swing.go2.JMap2DFrame;
import org.geotoolkit.map.MapBuilder;
import org.geotoolkit.map.MapContext;
import org.geotoolkit.util.RandomStyleFactory;

public class TestShapefile {
    public static void main(String[] args) throws Exception {
        final DataStore ds = DataStoreFinder.getDataStore("url", new 
URL("file:/home/sorel/temp/world/world.shp"));
        final MapContext ctx = MapBuilder.createContext();
        final FeatureCollection col = 
ds.createSession(true).getFeatureCollection(QueryBuilder.all(ds.getNames().iterator().next()));
        ctx.layers().add(MapBuilder.createFeatureLayer(col, 
RandomStyleFactory.createRandomVectorStyle(col)));
        JMap2DFrame.show(ctx);
    }
}


Riou Yvan N2A (DAS SDMOL SCTIG) wrote:
> Johann,
>  
> I tried the zoom all button in the toolbar of J2DMapFrame GUI and also 
> the zoom to layer on the layer properties but nothing still displays 
> on the frame.
>  
> Would you let me try any shapefile of your own, not too heavy, that 
> you succesfully display ? I could then know if it's my data or my code 
> which is wrong ....
>  
> Thanks,
>  
> yvan.
>  
> 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