Escape double quotes in mapfiles/mapscript?
Mike Leahy
mgleahy at GOLDEN.NET
Sat May 13 22:52:10 PDT 2006
Andreas,
I did give this a try with single quotes, and while the mapfile will
successfully load as a php_mapscript map ojbect (using Chameleon), the
map will not draw in the chameleon interface. I've figured out that
this is because when Chameleon uses the mapscript map object to
write/restore the mapfile to a temporary file for each session in PHP -
when this happens, the DATA string in the output mapfile that is written
to the PHP session folder reverts to using double-quotes instead of
single quotes. I guess this relates to the bug that Tamras pointed out
(http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1549).
From the looks of things, there's no fix in the near future for this
other than to make sure my PostGIS data strings don't require double quotes.
Thanks anyway,
Mike
Andreas Albarello wrote:
>Mike Leahy wrote:
>> I'm wondering if there is currently any way to escape double quotes in
>> mapfile properties. As an example, I want to be able to use a query on
>> a PostGIS table as the data source for a layer, where columns' aliases
>> have double quotes around them, as is normally done in PostgreSQL when
>> spaces or other characters are involved (e.g., the following would
crash
>> MapServer 4.8:
>Mike,
>as Tamas already pointed out by listing a couple of bugs filed about
>this issue, there's currently no way to do so. You simply can't have >the
>same character you use as delimiter for a certain string (which for
>Mapserver is either a double quote or a single quote) inside that >string.
>> DATA "the_geom from (select id as \"Field ID\", the_geom from
sometable)
>> as foo using unique \"Field ID\" using srid 5326;"
>You should however be able to address this particular issue by putting
>single quotes instead of double quotes around your DATA definition. >This
>should make it possible to use double quotes inside. The same applies
>vice versa, of course, as long as you don't need to use both types of
>quotes inside the same string, which is not possible at all.
>Best regards,
>--
--------------------------------------------------------------------
>Andreas Albarello Analysis & SW Development Territorium Online
srl/GmbH >Via Buozzi/Buozzistraße 12 - I 39100 Bolzano/Bozen email:
>andreas.albarello at territoriumonline.com web: www.territoriumonline.com
>--------------------------------------------------------------------
>Mike Leahy wrote:
>> Hello list,
>>
>> I'm wondering if there is currently any way to escape double quotes in
>> mapfile properties. As an example, I want to be able to use a query on
>> a PostGIS table as the data source for a layer, where columns' aliases
>> have double quotes around them, as is normally done in PostgreSQL when
>> spaces or other characters are involved (e.g., the following would crash
>> MapServer 4.8:
>>
>> DATA "the_geom from (select id as \"Field ID\", the_geom from sometable)
>> as foo using unique \"Field ID\" using srid 5326;"
>>
>> I also tried using two double quotes, but that didn't work either. I
>> noticed some discussion in a bug report related to this from a while
>> back (http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=681), but as far
>> as I can tell, it hasn't been addressed. I can come up with my own
>> workarounds for the problems, but I'd rather be sure whether or not this
>> is possible first...
>>
>> Thanks in advance for any advice,
>> Mike
>>
More information about the MapServer-users
mailing list