GetMap请求return白图
GetMap request return white image
我只是在尝试使用 Mapserver 通过 GetMap 请求显示我的地图时遇到问题,但它 return 是白色图像。我确实进行了搜索,但没有找到答案:
我的地图文件:
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
这是我用于请求的 Link :
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
BBox 值正确。谢谢
您的 URL 上似乎缺少 SERVICE=WMS 参数。
当我将 epsg:4326 替换为 CRS:84 和 URL 时,我确实解决了问题:
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
WMS 1.1.1 和 WMS 1.3.0 版本对坐标系有不同的请求参数:SRS=EPSG:4326 for 1.1.1 and CRS=CRS:84 for 1.3.0
我只是在尝试使用 Mapserver 通过 GetMap 请求显示我的地图时遇到问题,但它 return 是白色图像。我确实进行了搜索,但没有找到答案: 我的地图文件:
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
这是我用于请求的 Link :
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
BBox 值正确。谢谢
您的 URL 上似乎缺少 SERVICE=WMS 参数。
当我将 epsg:4326 替换为 CRS:84 和 URL 时,我确实解决了问题:
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
WMS 1.1.1 和 WMS 1.3.0 版本对坐标系有不同的请求参数:SRS=EPSG:4326 for 1.1.1 and CRS=CRS:84 for 1.3.0