Hi Gang,
I have several questions regarding the (de-)serializazion of jsons in Qi4j.
1.)
Given is the following GeoJSON :
{ "type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [102.0, 0.5]},
"properties": {"prop0": "value0"}
},
{ "type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
]
},
"properties": {
"prop0": "value0",
"prop1": 0.0
}
},
{ "type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0] ]
]
},
"properties": {
"prop0": "value0",
"prop1": {"this": "that"}
}
}
]
}
It is copied from the GeoJSON spec at http://geojson.org/geojson-spec.html.
The FeatureCollection is a array of Features that contains one of the defined Geometries. This
are Point, LineString, Polygon, etc. To parse those simple types is not a problem, but the type
Feature can be a Point, LineString, etc..
I defined the Feature like this :
public interface TGeomFeature extends TGeom {
Property<TGeometry> geometry();
Property<Map<String, String>> properties();
}
TGeometry is defined as
public interface TGeometry extends TGeom {
@Optional
Property<String> type();
}
and is common for TGeomPoint, TGeomPolygon, etc. Problem is here that Qi4j does not know what
kind of object Property<TGeometry> geometry() is. The "_type" is not availalbe as this GeoJSON
is defined/created "outside" of Qi4j.
2.)
This GeoJson files tent to be really huge. Huge means about 300 GB for a GeoJson Europa export
from openstreetmaps. I;m not exactly sure how the Qi4j deserializer works, but it looks like that
the whole thing has to be first loaded to memory and then all the Objects are generated. Here a kind
of iterating approach would help a lot.
Thank you.
Cheers,
jj