Question

I'm trying to get to work the GeoTools quickstart tutorial. I've downloaded a map from http://www.naturalearthdata.com.

The file is:

http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/ne_10m_admin_0_countries.zip

This is not exactly the file linked in the tutorial because that seems to be a dead link, resulting in a 404 Not Found. However since the one I've choosen is from the same site I hope that it's correct.

All the tutorial is a static main method with the following code.

    File file = JFileDataStoreChooser.showOpenFile("shp", new File("."), null);
    FileDataStore store = FileDataStoreFinder.getDataStore(file);
    SimpleFeatureSource featureSource = store.getFeatureSource();

    // Create a map content and add our shapefile to it
    MapContent map = new MapContent();
    map.setTitle("Quickstart");

    Style style = SLD.createSimpleStyle(featureSource.getSchema());
    Layer layer = new FeatureLayer(featureSource, style);
    map.addLayer(layer);

    // Now display the map
    JMapFrame.showMap(map);

But

when i run it and select the shp file (extracted from the download), after a few seconds i get the following exception:

SEVERE: Invalid empty measure '', was expecting a number, eventually followed by px, m or ft

In debug i see that is thrown by the line:

JMapFrame.showMap(map);

How can I fix this?

Was it helpful?

Solution

I had the same error. Don't know why but it works for me using version 10-SNAPSHOT from the snapshot repository

<dependency>
  <groupId>org.geotools</groupId>
  <artifactId>gt-shapefile</artifactId>
  <version>10-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>org.geotools</groupId>
  <artifactId>gt-swing</artifactId>
  <version>10-SNAPSHOT</version>
</dependency>

<repository>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
  <id>opengeo</id>
  <name>OpenGeo Maven Repository</name>
  <url>http://repo.opengeo.org</url>
</repository>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top