[mapserver-users] [RESOLVED:] Mapserver/PostGIS map file problem (double quotes in layer 'DATA' element)

Peter Willis peterw at borstad.com
Wed May 27 16:26:17 PDT 2009


After a bit of experimentation I have discovered that
using single quotes, to enclose the element value, allows
double quotes to be used in the query.

ie:

DATA 'the_geom from (select oid,gid, the_geom, 
"Area","Perimeter","PixelValue" FROM global_Land_poly WHERE 
"PixelValue"=1 ) AS FOO using SRID=4326'


Thanks to all,

Peter


Peter Willis wrote:
> 
> I tried that. I get the following error:
> 
> loadLayer(): Unknown identifier. Parsing error near (Area):(line 30)
> 
> Mapserver doesn't appear to like the additional formatting.
> Do I need to recompile with system regex I wonder....?
> 
> Peter
> 
> 
> Adam Eskreis wrote:
>> You could try regex
>>
>> \"Area\"
>>
>> -Adam
>>
>> On Wed, May 27, 2009 at 6:48 PM, Peter Willis <peterw at borstad.com 
>> <mailto:peterw at borstad.com>> wrote:
>>
>>
>>     Hello,
>>
>>     I am having a problem serving a PostGIS layer via mapserver
>>     as WFS.
>>
>>     The problem arises from the generation/use of column names
>>     in PostgreSQL that require double quotes.
>>
>>     ie:
>>
>>      SELECT oid,gid, the_geom, "Area","Perimeter","PixelValue" FROM
>>     global_Land_poly WHERE "PixelValue"=1;
>>
>>
>>
>>     In the map file the 'DATA' member of the PostGIS layer is defined as:
>>
>>     DATA "the_geom from (select oid,gid, the_geom,
>>     Area,Perimeter,PixelValue FROM global_Land_poly WHERE PixelValue=1 )
>>     AS FOO using SRID=4326"
>>
>>
>>     <ERR>Mapserver relays a PostGIS error from PostgreSQL:
>>     'ERROR:  column "area" does not exist...</ERR>
>>
>>     This is because the column name is actually "Area"
>>     and requires quotes.
>>
>>     How do I define double quotes in my PostGIS query
>>     within the 'DATA' element of my mapfile layer?
>>
>>     Thanks for any enlightenment,
>>
>>     Peter
>>     _______________________________________________
>>     mapserver-users mailing list
>>     mapserver-users at lists.osgeo.org 
>> <mailto:mapserver-users at lists.osgeo.org>
>>     http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 
> 


-- 
Peter Willis

Remote Sensing Analyst, Programmer, Electronics Technician

ASL Borstad Remote Sensing Inc.

1986 Mills Road
Sidney, British Columbia, Canada V8L5Y3
Tel: 250-656-0177 extension 135



More information about the MapServer-users mailing list