Re: [mapserver-users] passing parameter to a OGRVRTDataSource layer
thanks Daniel but even if you didn't tried it, can you comment HOW mapserver would react in terms of performance regarding the 3 approch (PointFromColumns, wkt, wkb)? MartinO On Thu, Mar 26, 2015 at 3:57 PM Daniel Morissette dmorisse...@mapgears.com wrote: On 2015-03-26 3:37 PM, Martin Ouellet wrote: Daniel: What do you think is the best way to encode point in a csv (using the virtual format of OGR) for mapserver: 1) x y coordinates with encoding=PointFromColumns 2) point in WKT string in the csv 3) point encoded WKB string in the csv 4) maybe something else BUT it must be in a csv format I have used only #1 with CSV and it works great and feels most natural for a CSV. I can't speak for WKT and WKB encoding in a CSV, never tried it. Daniel -- Daniel Morissette T: +1 418-696-5056 #201 http://www.mapgears.com/ Provider of Professional MapServer Support since 2000 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] passing parameter to a OGRVRTDataSource layer
I believe the variable substitution is working since you see the coordinate values in the exception message received from the server. The error message says that it cannot find layer select in the OGR data source, so it may very well be that it ends up being called something else for some reason. I'd suggest hardcoding the coordinate values in your VRT and starting by making the VRT works with hardcoded values. Once it works, put the variables back in. Just a guess, but ogrinfo on that VRT may help figure out the source of the problem. Daniel On 2015-03-25 4:47 PM, Fawcett, David (MNIT) wrote: Martin, Have you looked at the CGI runtime substitution docs?: http://mapserver.org/cgi/runsub.html Make sure that you look at the validation section near the bottom. If the substitution works with CGI WMS, you will need validation. David. *From:*mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] *On Behalf Of *Martin Ouellet *Sent:* Wednesday, March 25, 2015 3:38 PM *To:* mapserver-users@lists.osgeo.org *Subject:* [mapserver-users] passing parameter to a OGRVRTDataSource layer Hi all, I'm using the virtual plugin of OGR to consume a web service who return CSV coordinates and mapserver is able to draw the points without any problems. The connection definition in my mapfile is something like this. CONNECTION OGRVRTDataSourceOGRVRTLayer name='select'SrcDataSourceCSV:/vsicurl/http://my server/service.php/SrcDataSourceGeometryTypewkbPoint/GeometryTypeSrcLayerselect/SrcLayerLayerSRSWGS84/LayerSRSGeometryField encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'//OGRVRTLayer/OGRVRTDataSource I would like to pass arguments to that CONNETION string so I could build dynamic request. something like this CONNECTION OGRVRTDataSourceOGRVRTLayer name='select'SrcDataSourceCSV:/vsicurl/http://my server/service.php?*param1=%PARAM1%amp;param2=%PARAM2%*/SrcDataSourceGeometryTypewkbPoint/GeometryTypeSrcLayerselect/SrcLayerLayerSRSWGS84/LayerSRSGeometryField encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'//OGRVRTLayer/OGRVRTDataSource I know the argument values (in my example PARAM1 and PARAM2) are OK because I'm seeing them in the error message thrown by mapserver (see below). But mapserver refuse to render the points: ?xml version='1.0' encoding=UTF-8 standalone=no ? !DOCTYPE ServiceExceptionReport SYSTEM http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd; ServiceExceptionReport version=1.1.1 ServiceException msDrawMap(): Image handling error. Failed to draw layer named #39;photo_ownedby_all#39;. msOGRFileNextShape(): OGR error. Failed to find layer #39;select#39; on datasource #39;CSV:/vsicurl/*http://my server/geophoto/select.php?PARAM1=40.886913500823205%2C-84.41259765625011amp;PARAM2=63.97980162961738%2C-43.587402343750284*#39;. /ServiceException /ServiceExceptionReport Strangely, if I copy paste this url in the browser, the web service is returning valid csv data: *http://my http://%3cmy server/geophoto/select.php?ll=40.886913500823205%2C-84.41259765625011amp;ur=63.97980162961738%2C-43.587402343750284* returned PHOTO_LATITUDE,PHOTO_LONGITUDE 48.8099315451953,-77.0906915758454 48.8119226339273,-77.123176861499 48.8139039864207,-77.1556648776822 48.8158756013937,-77.1881556113468 48.8178374775437,-77.2206490494331 48.8171607148511,-77.2546364217682 48.8164732928131,-77.2886228129866 48.8157752119077,-77.3226082078249 48.815066472652,-77.356592590973 any thoughts? MartinO ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Daniel Morissette T: +1 418-696-5056 #201 http://www.mapgears.com/ Provider of Professional MapServer Support since 2000 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] passing parameter to a OGRVRTDataSource layer
On 2015-03-26 3:37 PM, Martin Ouellet wrote: Daniel: What do you think is the best way to encode point in a csv (using the virtual format of OGR) for mapserver: 1) x y coordinates with encoding=PointFromColumns 2) point in WKT string in the csv 3) point encoded WKB string in the csv 4) maybe something else BUT it must be in a csv format I have used only #1 with CSV and it works great and feels most natural for a CSV. I can't speak for WKT and WKB encoding in a CSV, never tried it. Daniel -- Daniel Morissette T: +1 418-696-5056 #201 http://www.mapgears.com/ Provider of Professional MapServer Support since 2000 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] passing parameter to a OGRVRTDataSource layer
Thank you David and Daniel for helping me. I found the problem. The error message was pointing at the layer 'select' but it was the dot (.) int the coordinates of the parameters that was causing the problem. Maybe an escaping problem related to the OGRVRTDataSource XML string. Daniel: What do you think is the best way to encode point in a csv (using the virtual format of OGR) for mapserver: 1) x y coordinates with encoding=PointFromColumns 2) point in WKT string in the csv 3) point encoded WKB string in the csv 4) maybe something else BUT it must be in a csv format cheers, MartinO On Thu, Mar 26, 2015 at 8:07 AM Daniel Morissette dmorisse...@mapgears.com wrote: I believe the variable substitution is working since you see the coordinate values in the exception message received from the server. The error message says that it cannot find layer select in the OGR data source, so it may very well be that it ends up being called something else for some reason. I'd suggest hardcoding the coordinate values in your VRT and starting by making the VRT works with hardcoded values. Once it works, put the variables back in. Just a guess, but ogrinfo on that VRT may help figure out the source of the problem. Daniel On 2015-03-25 4:47 PM, Fawcett, David (MNIT) wrote: Martin, Have you looked at the CGI runtime substitution docs?: http://mapserver.org/cgi/runsub.html Make sure that you look at the validation section near the bottom. If the substitution works with CGI WMS, you will need validation. David. *From:*mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] *On Behalf Of *Martin Ouellet *Sent:* Wednesday, March 25, 2015 3:38 PM *To:* mapserver-users@lists.osgeo.org *Subject:* [mapserver-users] passing parameter to a OGRVRTDataSource layer Hi all, I'm using the virtual plugin of OGR to consume a web service who return CSV coordinates and mapserver is able to draw the points without any problems. The connection definition in my mapfile is something like this. CONNECTION OGRVRTDataSourceOGRVRTLayer name='select'SrcDataSourceCSV:/vsicurl/http://my server/service.php/SrcDataSourceGeometryTypewkbPoint/ GeometryTypeSrcLayerselect/SrcLayerLayerSRSWGS84/LayerSRS GeometryField encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'//OGRVRTLayer/OGRVRTDataSource I would like to pass arguments to that CONNETION string so I could build dynamic request. something like this CONNECTION OGRVRTDataSourceOGRVRTLayer name='select'SrcDataSourceCSV:/vsicurl/http://my server/service.php?*param1=%PARAM1%amp;param2=%PARAM2%*/S rcDataSourceGeometryTypewkbPoint/GeometryTypeSrcLayer select/SrcLayerLayerSRSWGS84/LayerSRSGeometryField encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'//OGRVRTLayer/OGRVRTDataSource I know the argument values (in my example PARAM1 and PARAM2) are OK because I'm seeing them in the error message thrown by mapserver (see below). But mapserver refuse to render the points: ?xml version='1.0' encoding=UTF-8 standalone=no ? !DOCTYPE ServiceExceptionReport SYSTEM http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd; ServiceExceptionReport version=1.1.1 ServiceException msDrawMap(): Image handling error. Failed to draw layer named #39;photo_ownedby_all#39;. msOGRFileNextShape(): OGR error. Failed to find layer #39;select#39; on datasource #39;CSV:/vsicurl/*http://my server/geophoto/select.php?PARAM1=40.886913500823205%2C-84. 41259765625011amp;PARAM2=63.97980162961738%2C-43.587402343750284*#39;. /ServiceException /ServiceExceptionReport Strangely, if I copy paste this url in the browser, the web service is returning valid csv data: *http://my http://%3cmy server/geophoto/select.php?ll=40.886913500823205%2C-84.4125 9765625011amp;ur=63.97980162961738%2C-43.587402343750284* returned PHOTO_LATITUDE,PHOTO_LONGITUDE 48.8099315451953,-77.0906915758454 48.8119226339273,-77.123176861499 48.8139039864207,-77.1556648776822 48.8158756013937,-77.1881556113468 48.8178374775437,-77.2206490494331 48.8171607148511,-77.2546364217682 48.8164732928131,-77.2886228129866 48.8157752119077,-77.3226082078249 48.815066472652,-77.356592590973 any thoughts? MartinO ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Daniel Morissette T: +1 418-696-5056 #201 http://www.mapgears.com/ Provider of Professional MapServer Support since 2000 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http
Re: [mapserver-users] passing parameter to a OGRVRTDataSource layer
Martin, Have you looked at the CGI runtime substitution docs?: http://mapserver.org/cgi/runsub.html Make sure that you look at the validation section near the bottom. If the substitution works with CGI WMS, you will need validation. David. From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Martin Ouellet Sent: Wednesday, March 25, 2015 3:38 PM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] passing parameter to a OGRVRTDataSource layer Hi all, I'm using the virtual plugin of OGR to consume a web service who return CSV coordinates and mapserver is able to draw the points without any problems. The connection definition in my mapfile is something like this. CONNECTION OGRVRTDataSourceOGRVRTLayer name='select'SrcDataSourceCSV:/vsicurl/http://my server/service.php/SrcDataSourceGeometryTypewkbPoint/GeometryTypeSrcLayerselect/SrcLayerLayerSRSWGS84/LayerSRSGeometryField encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'//OGRVRTLayer/OGRVRTDataSource I would like to pass arguments to that CONNETION string so I could build dynamic request. something like this CONNECTION OGRVRTDataSourceOGRVRTLayer name='select'SrcDataSourceCSV:/vsicurl/http://my server/service.php?param1=%PARAM1%amp;param2=%PARAM2%/SrcDataSourceGeometryTypewkbPoint/GeometryTypeSrcLayerselect/SrcLayerLayerSRSWGS84/LayerSRSGeometryField encoding='PointFromColumns' x='PHOTO_LONGITUDE' y='PHOTO_LATITUDE'//OGRVRTLayer/OGRVRTDataSource I know the argument values (in my example PARAM1 and PARAM2) are OK because I'm seeing them in the error message thrown by mapserver (see below). But mapserver refuse to render the points: ?xml version='1.0' encoding=UTF-8 standalone=no ? !DOCTYPE ServiceExceptionReport SYSTEM http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd; ServiceExceptionReport version=1.1.1 ServiceException msDrawMap(): Image handling error. Failed to draw layer named #39;photo_ownedby_all#39;. msOGRFileNextShape(): OGR error. Failed to find layer #39;select#39; on datasource #39;CSV:/vsicurl/http://my server/geophoto/select.php?PARAM1=40.886913500823205%2C-84.41259765625011amp;PARAM2=63.97980162961738%2C-43.587402343750284#39;. /ServiceException /ServiceExceptionReport Strangely, if I copy paste this url in the browser, the web service is returning valid csv data: http://myhttp://%3cmy server/geophoto/select.php?ll=40.886913500823205%2C-84.41259765625011amp;ur=63.97980162961738%2C-43.587402343750284 returned PHOTO_LATITUDE,PHOTO_LONGITUDE 48.8099315451953,-77.0906915758454 48.8119226339273,-77.123176861499 48.8139039864207,-77.1556648776822 48.8158756013937,-77.1881556113468 48.8178374775437,-77.2206490494331 48.8171607148511,-77.2546364217682 48.8164732928131,-77.2886228129866 48.8157752119077,-77.3226082078249 48.815066472652,-77.356592590973 any thoughts? MartinO ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users