[gdal-dev] issue with Virtual Format and a remote CSV service

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] issue with Virtual Format and a remote CSV service

geomartino
Hi all,

I have a solr service which provide a valid csv response like this:
PHOTO_LATITUDE,PHOTO_LONGITUDE,ID
49.482333,-82.580556,A21524-047-1970-0
49.485278,-82.640444,A21524-048-1970-0
49.487583,-82.701194,A21524-049-1970-0
49.490444,-82.761111,A21524-050-1970-0
49.490333,-82.824333,A21524-051-1970-0
my vrt is:
<OGRVRTDataSource>
<OGRVRTLayer name="coord">
<SrcDataSource>http://solr/select?q=*%3A*&fl=PHOTO_LATITUDE%2CPHOTO_LONGITUDE%2CID&wt=csv</SrcDataSource>
<SrcLayer>coord</SrcLayer>
<GeometryType>wkbPoint</GeometryType> <LayerSRS>WGS84</LayerSRS> <GeometryField encoding="PointFromColumns" x="PHOTO_LONGITUDE" y="PHOTO_LATITUDE"/> </OGRVRTLayer> </OGRVRTDataSource>

I've try to escape the & with &amp; in the url like the suggestions here but in all cases, I still receive this error:
msOGRFileNextShape(): OGR error. Failed to read GeoJSON data
any ideas?
MartinO

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: issue with Virtual Format and a remote CSV service

Even Rouault-2
Le mardi 24 mars 2015 22:16:30, Martin Ouellet a écrit :

> Hi all,
>
> I have a solr service which provide a valid csv response like this:
>
> PHOTO_LATITUDE,PHOTO_LONGITUDE,ID
> 49.482333,-82.580556,A21524-047-1970-0
> 49.485278,-82.640444,A21524-048-1970-0
> 49.487583,-82.701194,A21524-049-1970-0
> 49.490444,-82.761111,A21524-050-1970-0
> 49.490333,-82.824333,A21524-051-1970-0
>
> my vrt is:
>
> <OGRVRTDataSource>
> <OGRVRTLayer name="coord">
> <SrcDataSource>http://solr/select?q=*%3A*&fl=PHOTO_LATITUDE%2CPHOTO_LONGITU
> DE%2CID&wt=csv</SrcDataSource> <SrcLayer>coord</SrcLayer>
> <GeometryType>wkbPoint</GeometryType>
> <LayerSRS>WGS84</LayerSRS>
> <GeometryField encoding="PointFromColumns" x="PHOTO_LONGITUDE"
> y="PHOTO_LATITUDE"/>
> </OGRVRTLayer>
> </OGRVRTDataSource>
>
> I've try to escape the & with &amp; in the url like the suggestions
> here
> <http://osgeo-org.1560.x6.nabble.com/Define-Virtual-Format-for-a-remote-Ge
> oJSON-file-td5173766.html>but in all cases, I still receive this error:
>
> msOGRFileNextShape(): OGR error. Failed to read GeoJSON data

You need to do XML escaping indeed (& --> &amp;) and also prefix the URL by
/vsicurl/ (the GeoJSON driver is the exception in that it tries to interpret
any string by http:// as a potential source for it)

>
> any ideas?
>
> MartinO

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: issue with Virtual Format and a remote CSV service

geomartino
Thanks Even for the quick response.  Is it ok to escape : (with %3A) and the comma (with %2C) in the vrt?

even with the prefix , I received another error:
OGR error. Failed to open datasource `/vsicurl/http://<my server>:8080/solr-geo2/collection2/select?q=*%3A*&amp;fl=PHOTO_LATITUDE%2CPHOTO_LONGITUDE%2CID&amp;wt=csv&#39;

cheers,

MartinO

On Tue, Mar 24, 2015 at 5:21 PM Even Rouault <[hidden email]> wrote:
Le mardi 24 mars 2015 22:16:30, Martin Ouellet a écrit :
> Hi all,
>
> I have a solr service which provide a valid csv response like this:
>
> PHOTO_LATITUDE,PHOTO_LONGITUDE,ID
> 49.482333,-82.580556,A21524-047-1970-0
> 49.485278,-82.640444,A21524-048-1970-0
> 49.487583,-82.701194,A21524-049-1970-0
> 49.490444,-82.761111,A21524-050-1970-0
> 49.490333,-82.824333,A21524-051-1970-0
>
> my vrt is:
>
> <OGRVRTDataSource>
> <OGRVRTLayer name="coord">
> <SrcDataSource>http://solr/select?q=*%3A*&fl=PHOTO_LATITUDE%2CPHOTO_LONGITU
> DE%2CID&wt=csv</SrcDataSource> <SrcLayer>coord</SrcLayer>
> <GeometryType>wkbPoint</GeometryType>
> <LayerSRS>WGS84</LayerSRS>
> <GeometryField encoding="PointFromColumns" x="PHOTO_LONGITUDE"
> y="PHOTO_LATITUDE"/>
> </OGRVRTLayer>
> </OGRVRTDataSource>
>
> I've try to escape the & with &amp; in the url like the suggestions
> here
> <http://osgeo-org.1560.x6.nabble.com/Define-Virtual-Format-for-a-remote-Ge
> oJSON-file-td5173766.html>but in all cases, I still receive this error:
>
> msOGRFileNextShape(): OGR error. Failed to read GeoJSON data

You need to do XML escaping indeed (& --> &amp;) and also prefix the URL by
/vsicurl/ (the GeoJSON driver is the exception in that it tries to interpret
any string by http:// as a potential source for it)

>
> any ideas?
>
> MartinO

--
Spatialys - Geospatial professional services
http://www.spatialys.com

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: issue with Virtual Format and a remote CSV service

jratike80
Martin Ouellet <geomartino <at> gmail.com> writes:

>
>
> Thanks Even for the quick response.  Is it ok to escape :
(with %3A) and
the comma (with %2C) in the vrt?even with the prefix ,
 I received another error:
> OGR error. Failed to open datasource `/vsicurl/http://<my
server>:8080/solr-geo2/collection2/select?q=*%3A*&
fl=PHOTO_LATITUDE%2CPHOTO_LONGITUDE%2CID&wt=csv'

Hi,

I put two test files here:
http://latuviitta.org/documents/rename%20test.gml (with space, %20)
http://latuviitta.org/documents/rename%26test.gml (with &, %26)

Reading the first one succeeds through this VRT:

<OGRVRTDataSource>
<OGRVRTLayer name="m_asalue">
<SrcDataSource>/vsicurl/http://latuviitta.org/documents
/rename%20test.gml</SrcDataSource>
</OGRVRTLayer>
</OGRVRTDataSource>

Save and test with "ogrinfo ogrvrttest2.xml -ro -al". Keep
SrcDataSource in one line when saving.

It was too hard a challenge for me to write a working VRT file for the
latter one with &. Who will be the first lucky one? All that must
be done is to guess the right syntax to place "&" character cleverly encoded
instead of _ENC_ in "rename_ENC_test.gml"

I have tried:
- URL-encoding to %26
- XML-encoding to &
- XML-encoding and then URL-encoding to %26amp%3B


-Jukka Rahkonen-


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev