I have the following GeoJSON file:
{"type":"FeatureCollection",
  "features":
  [
    {"type":"Feature",
     "geometry":{"type":"Point","coordinates":[0.0, 0.0]},
     "properties":{"NAME":"Point-0001"}
    },
    {"type":"Feature",
     "geometry":{"type":"Point","coordinates":[1.0, 1.0]},
     "properties":{"NAME":"Point-0002","ALIAS":"Point2"}
    }
  ]
}

My code:
BufferedReader reader = new BufferedReader(new FileReader(srcFile));
FeatureJSON fjson = new FeatureJSON();
FeatureIterator<SimpleFeature> features =
    fjson.streamFeatureCollection(reader);
while (features.hasNext()) {
...
}

The first feature is read just fine. But when I get to the next feature, I
get the following exception on the call to hasNext():
java.lang.RuntimeException: java.lang.IllegalArgumentException: No such
attribute:ALIAS
    at
org.geotools.geojson.feature.FeatureJSON$FeatureCollectionIterator.readNext(FeatureJSON.java:533)
    at
org.geotools.geojson.feature.FeatureJSON$FeatureCollectionIterator.hasNext(FeatureJSON.java:517)

Can't I use SimpleFeature in this case? What is causing the exception?

Thanks,
Rico
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to