[mapserver-users] Imagemap size doesn't match display map
Fawcett, David
David.Fawcett at state.mn.us
Fri Jan 9 11:07:39 PST 2009
Soren,
I think that you are running into the issue where a WMS request can
return non-square pixels, and that the ratio of height:width in your
extent is not the same as the ratio of height:width in your image size.
If you can make this as a regular CGI call, you won't see this problem.
If you need to use WMS, make sure that you make the ratio's the same.
e.g. 500/275 does not equal 60/26.
David.
-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of sscottgis
Sent: Friday, January 09, 2009 12:48 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Imagemap size doesn't match display map
I have created an imagemap/image for the lower 48 states using 2
mapfiles to define the polygons following the demo in the wiki. They
noted that if you use separate maps, the SIZE and EXTENT should be the
same. I have those set the same in both files, but the imagemap that
gets returned is vertically squished.
Here's the map file for the imagemap layer:
MAP
NAME "droughtplan_imgmap"
STATUS ON
SIZE 500 275
# set projection for map
PROJECTION
"init=epsg:4326"
END
EXTENT -126 24 -66 50
UNITS METERS
STATUS ON
IMAGECOLOR 255 255 255
WEB
IMAGEPATH "e:/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
END
#QUERYMAP
# STATUS ON
# STYLE NORMAL
#END
LAYER
NAME "droughtplans_imgmap"
STATUS DEFAULT
TYPE POLYGON
DATA "../data/droughtplans_imgmap"
TEMPLATE "planbody.html"
HEADER "planheader.html"
FOOTER "planfooter.html"
CLASSITEM "State"
CLASS
COLOR -1 -1 -1
NAME "State"
OUTLINECOLOR 110 110 110
END
END
END
END
and the file for the display layer:
MAP
NAME "droughtplan_wms"
STATUS ON
SIZE 500 275
# set projection for map
PROJECTION
"init=epsg:4326"
END
EXTENT -126 24 -66 50
UNITS METERS
STATUS ON
IMAGECOLOR 255 255 255
# image format
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
WEB
IMAGEPATH "e:/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
HEADER "../templates/query_header.html"
FOOTER "../templates/query_footer.html"
END
QUERYMAP
STATUS ON
STYLE NORMAL
END
LAYER
NAME "droughtplans"
STATUS DEFAULT
TYPE POLYGON
DATA "../data/droughtplans"
DUMP TRUE
HEADER ../templates/ndmc_query_header.html
TEMPLATE ../templates/ndmc_query_body.html
CLASSITEM "Status"
CLASS
COLOR 255 255 255
OUTLINECOLOR 110 110 110
EXPRESSION "0"
NAME "No Plan"
SYMBOL 0
END
CLASS
COLOR 139 209 0
OUTLINECOLOR 110 110 110
EXPRESSION "1"
NAME "Emphasizing Mitigation"
SYMBOL 0
END
CLASS
COLOR 255 255 0
OUTLINECOLOR 110 110 110
EXPRESSION "2"
NAME "Emphasizing Response"
SYMBOL 0
END
CLASS
COLOR 255 128 0
OUTLINECOLOR 110 110 110
EXPRESSION "3"
NAME "Emphasizing Disaster"
SYMBOL 0
END
CLASS
COLOR 255 0 0
OUTLINECOLOR 110 110 110
EXPRESSION "4"
NAME "Local Plans"
SYMBOL 0
END
END
END
END
The header and footer are the basic <map> tags described in the wiki,
but with the map height and width set to the 500, 275 dimensions from
the files.
Here's the body template:
<area shape="poly" coords="[shpxy precision=0 proj=image]"
href="http://myserver/Resources/state.aspx?state=[State]"
title="[State]" alt="[State]">
and the call to the image layer (these are part of an ASP.NET 2.0 web
page and added as part of an httprequest):
http://myserver/cgi-bin/mapserv.exe?map=/ms4w/apps/drmon/service/drought
plans_wms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=droughtpla
ns&WIDTH=500&HEIGHT=275&srs=EPSG:4326&styles=default&format=image/png&bb
ox=-126,24,-66,50
I've got the extents and sizes set to the same 500, 275 dimensions
everywhere, but the imagemap is still flattened (more like a box at 500
x 200). Everything else works fine--all of the areas are defined, the
links work,etc; it just isn't aligned properly. Is there something
missing or something else going on here?
Any help/ideas are greatly appreciated.
Soren
--
View this message in context:
http://n2.nabble.com/Imagemap-size-doesn%27t-match-display-map-tp2134663
p2134663.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list