[mapserver-users] Dynamic SQL

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Nov 3 13:44:49 EST 2008


Browse mode expects an imgext in this case. It's necessary to turn the img.x and img.y into
map coordinates. Imgext is the extent of the map you clicked in.

Steve

>>> On 11/3/2008 at 5:51 AM, in message
<2c9bd88a0811030351r2bde05c5m65d0aad40361490e at mail.gmail.com>, "Denis Rykov"
<rykovd at gmail.com> wrote:
> 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.ma 
> p&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?



More information about the mapserver-users mailing list