[gdal-dev] Streaming Parser for OGR GeoJSON Driver
Even Rouault
even.rouault at spatialys.com
Fri Jan 29 01:19:48 PST 2016
>
> Perhaps it works because I am only appending to a single layer that has the
> same schema throughout?
Yes
> I did test this, but the performance was indeed slower. Is there a way for
> me to specify the schema before-hand and avoid a full first pass?
>
> Perhaps for a driver implementation with a streaming parser, I could write
> a vrt before hand, then pipe in GeoJSON that matches that schema?
Yes, if you know the fields, you can do something like:
<OGRVRTDataSource>
<OGRVRTUnionLayer>
<OGRVRTLayer name="OGRGeoJSON">
<SrcDataSource>tmp1.json</SrcDataSource>
</OGRVRTLayer>
<OGRVRTLayer name="OGRGeoJSON">
<SrcDataSource>tmp2.json</SrcDataSource>
</OGRVRTLayer>
<Field name="..." type="..."/>
...
<Field name="..." type="..."/>
</OGRVRTUnionLayer>
</OGRVRTDataSource>
And if you don't know them but are OK to take the one of the first sources (so
your current strategy) :
<OGRVRTDataSource>
<OGRVRTUnionLayer>
<OGRVRTLayer name="OGRGeoJSON">
<SrcDataSource>tmp1.json</SrcDataSource>
</OGRVRTLayer>
<OGRVRTLayer name="OGRGeoJSON">
<SrcDataSource>tmp2.json</SrcDataSource>
</OGRVRTLayer>
<FieldStrategy>FirstLayer</FieldStrategy>
</OGRVRTUnionLayer>
</OGRVRTDataSource>
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list