[mapserver-users] Dynamic SQL

Denis Rykov rykovd at gmail.com
Mon Nov 3 06:51:54 EST 2008


Hi all! This is my map-file:

MAP
 IMAGETYPE GIF
 EXTENT 77.892399 49.045435 87.227800 56.044065
 SIZE 800 600
 WEB
 TEMPLATE "/ms4w/apps/mslocal/templates/exampleGL.html"
 IMAGEPATH "/ms4w/tmp/ms_tmp/"
 IMAGEURL "/ms_tmp/"
 END
 LAYER
 NAME "roads"
 CONNECTIONTYPE postgis
 CONNECTION "user=postgres password=gaster84 dbname=city host=localhost"

 DATA "the_geom from (SELECT the_geom,gid, distance(the_geom,
geometryfromtext('POINT(' || (%mx% + %img.x% * %mw% / %iw%) || ' '
|| (%my% - %img.y% * %mh% / %ih%) || ')',4326)) AS dist FROM
roads) as foo using srid=4326 using unique gid"

 TYPE LINE
 ...

When i insert url such as
http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/mslocal/map/exampleGL.map&layer=roads&mx=77&my=87&iw=800&ih=600&mw=10&mh=7&mode=browse&img.x=400&img.y=400
MapServer returns error

msDrawMap(): Image handling error. Unable to initialize image.
msCalculateScale(): General error message. Invalid image extent,
minx=-1.000000, miny=-1.000000, maxx=-1.000000, maxy=-1.000000.
msCalculateScale(): General error message. Invalid image extent,
minx=-1.000000, miny=-1.000000, maxx=-1.000000, maxy=-1.000000.

If i use map file (fragment):

 DATA "the_geom from (SELECT the_geom,gid, distance(the_geom,
geometryfromtext('POINT(' || (%mx% + %imgx% * %mw% / %iw%) || ' '
|| (%my% - %imgy% * %mh% / %ih%) || ')',4326)) AS dist FROM
roads) as foo using srid=4326 using unique gid"

and url
http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/mslocal/map/exampleGL2.map&layer=roads&mx=77&my=56&iw=800&ih=600&mw=10&mh=7&mode=browse&imgx=400&imgy=400
MapServer works correctly and generate map. If i click on map then img.x and
img.y automatically added to url and MapServer returns error such i write
above.

Please help me. I want, that mouse click coordinates returns to the mapfile.
What I need do?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081103/ed6b451f/attachment.html


More information about the mapserver-users mailing list