我在使用Mapserver尝试使用GetMap请求显示我的地图时遇到问题,但它返回一个白色图像。我做了搜索,但我没有找到答案: 我的地图文件:
MAP
IMAGETYPE PNG
EXTENT -21 20 1 36
SIZE 700 400
IMAGECOLOR 255 255 255
PROJECTION
"init=epsg:4326"
END
OUTPUTFORMAT
NAME png
MIMETYPE image/png
DRIVER GD/PNG
EXTENSION png
IMAGEMODE PC256
TRANSPARENT FALSE
END
WEB
METADATA
"wms_title" "Dans Layers and Stuff"
"wms_onlineresource" "http://localhost:81/cgi-bin/mapserv.exe?"
"wms_enable_request" "*"
"wms_srs" "EPSG:4326"
"wms_feature_info_mime_type" "text/html"
"wms_format" "image/png"
END
END
LAYER
NAME map1
TYPE polygon
STATUS default
CONNECTIONTYPE postgis
CONNECTION "dbname=postgres host=localhost port=5432 user=postgres"
DATA "geom from comgeo"
PROJECTION
"init=epsg:4326"
END
METADATA
"wms_title" "map1"
END
PROCESSING "SCALE=AUTO"
CLASS
STYLE
COLOR 232 232 232
OUTLINECOLOR 32 32 32
END
END
END
END
这就是我用于我的请求的链接:
http://localhost:81/cgi-bin/mapserv.exe?map=/wamp64/www/wordpress/map1.map&version=1.3.0&request=GetMap&CRS=EPSG:4326&bbox=-21,20,1,36&width=760&height=360&layers=map1&styles=&FORMAT=image/png&TRANSPARENT=TRUE
答案 0 :(得分:1)
您的网址上似乎缺少SERVICE = WMS参数。
答案 1 :(得分:0)
当我用CRS:84和URL替换epsg:4326时,我确实解决了问题:
http://localhost:81/cgi-bin/mapserv.exe?map=/wamp64/www/wordpress/map1.map&request=GetMap&SERVICE=WMS&version=1.3.0&CRS=CRS:84&bbox=-21,20,1,36&width=700&height=400&layers=map1&styles=&FORMAT=image/png&TRANSPARENT=TRUE
答案 2 :(得分:0)
WMS 1.1.1和WMS 1.3.0的版本对坐标系有不同的请求参数:SRS = EPSG:对于1.1.1为4326,对于1.3.0为CRS = CRS:84