[gdal-dev] Define Virtual Format for a remote GeoJSON file

Homme Zwaagstra hrz at geodata.soton.ac.uk
Wed Nov 19 09:14:19 PST 2014


Hi Andrea,

The VRT is an XML format and hence you need to ensure the content is XML 
compliant: your URL contained `&` characters that need to be escaped to 
`&`.  The following VRT works for me:

<OGRVRTDataSource>
   <OGRVRTLayer name="OGRGeoJSON">
<SrcDataSource>http://www.provincia.caltanissetta.sitr.it/ArcGIS/rest/services/Immobili/MapServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json</SrcDataSource>
     <LayerSRS>EPSG:3004</LayerSRS>
     <SrcLayer>OGRGeoJSON</SrcLayer>
   </OGRVRTLayer>
</OGRVRTDataSource>

Best regards,

Homme

On 19/11/14 13:22, aborruso wrote:
> Hi Even,
 > thank you.
 >
 >
 > Even Rouault-2 wrote
 >> Yes, you can use the URL as the datasource name expected by the VRT
 >> format.
 >
 > I have tried with:
 > <OGRVRTDataSource>
 >     <OGRVRTLayer name="OGRGeoJSON">
 >
 > 
<SrcDataSource>http://www.provincia.caltanissetta.sitr.it/ArcGIS/rest/services/Immobili/MapServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json</SrcDataSource>
 >         <LayerSRS>EPSG:3004</LayerSRS>
 >         <SrcLayer>OGRGeoJSON</SrcLayer>
 >     </OGRVRTLayer>
 > </OGRVRTDataSource>
 >
 > But if I run "ogrinfo -ro my_virtual_format_file.vrt" I have:
 > INFO: Open of `my_virtual_format_file.vrt'
 >       using driver `VRT' successful.
 > 1: OGRGeoJSONERROR 4: Failed to read GeoJSON data
 >
 > If I run:
 > ogrinfo -ro
 > 
"http://www.provincia.caltanissetta.sitr.it/ArcGIS/rest/services/Immobili/MapServer/0/query?where=objectid+%3D+objectid&outfields=*&f=json"
 > OGRGeoJSON -summary
 >
 > It's all OK.
 >
 > What's wrong in my VRT definition?
 >
 > Thank you again,
 >
 > a
 >
 >
 >
 >
 > --
 > View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Define-Virtual-Format-for-a-remote-GeoJSON-file-tp5173766p5173799.html
 > Sent from the GDAL - Dev mailing list archive at Nabble.com.
 > _______________________________________________
 > gdal-dev mailing list
 > gdal-dev at lists.osgeo.org
 > http://lists.osgeo.org/mailman/listinfo/gdal-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20141119/46673e1b/attachment-0001.html>


More information about the gdal-dev mailing list