|
From: Gus M. <gus...@gm...> - 2012-05-04 00:18:08
|
Hi All,
I've been happily using the GeoJSON library but have run into a
problem. Basically it doesn't seem to handle the case where features
have differing properties, for example;
Reading this feature collection
{"type":"FeatureCollection",
"features":[
{"type":"Feature","geometry":{"type":"Point","coordinates":[144.5719,-37.6786]},"properties":{"A":"1"},"id":"points.1"},
{"type":"Feature","geometry":{"type":"Point","coordinates":[144.5976,-37.678]},"properties":{"B":"3"},"id":"points.3"}
]
}
With something like this
FeatureJSON fj = new FeatureJSON();
FeatureIterator<SimpleFeature> features =
fj.streamFeatureCollection(url.openConnection().getInputStream());
while (features.hasNext()) {
SimpleFeature feature = (SimpleFeature) features.next()
}
Results in an exception
java.lang.IllegalArgumentException: No such attribute:B
Any thoughts? Is there a workaround?
Regards
Gus MacAulay
|