【问题标题】:Mapserver trouble wrapping cgi-bin/mapserv and map=mapfile.map地图服务器包装 cgi-bin/mapserv 和 map=mapfile.map 的问题
【发布时间】:2020-02-12 12:58:03
【问题描述】:

我使用的是 Mapserver 7.0.7 (MS4W 3.2.8),我无法包装 cgi-bin/mapserv 和 map=mapfile.map


工作正常

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map&service=WMS&request=GetMap&layers=LAT&styles=&format=image%2Fpng&transparent=true&version=1.3.0&tiled=true&width=512&height=512&crs=EPSG%3A3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082

result


在.htaccess 中使用RewriteRule 进入我的leafletjs web 上的文件夹

重写规则 ^ms(.*)$ http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map$1

http://10.1.3.21/Leaflet/ms&service=WMS&request=GetMap&layers=LAT&styles=&format=image%2Fpng&transparent=true&version=1.3.0&tiled=true&width=512&height=512&crs=EPSG%3A3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082

结果:

未找到 所请求的URL /Leaflet/ms&service=WMS&request=GetMap&layers=LAT&styles=&format=image/png&transparent=true&version=1.3.0&tiled=true&width=512&height=512&crs=EPSG:3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082未找到在这台服务器上。


但是是一个有效的 GetCapabilities 请求

http://localhost/Leaflet/ms&service=WMS&version=1.0.0&request=GetCapabilities

它被替换为 =>

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map&service=WMS&version=1.0.0&request=GetCapabilities

结果:

<!--  end of DOCTYPE declaration  -->
<WMT_MS_Capabilities version="1.0.0">
<!--
 MapServer version 7.0.7 (MS4W 3.2.8) OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE 
-->
<Service>
<Name>GetMap</Name>
<Title>Leaflet - WMS</Title>
<OnlineResource>http://localhost/Leaflet/ms?</OnlineResource>
</Service>
... 

【问题讨论】:

  • 我认为您错过了一些“结果”图像。
  • 只有第一个结果是img,其余的都是评论

标签: .htaccess url mod-rewrite wrapper mapserver


【解决方案1】:

您的重写规则正在删除重要的 ? 查询字符串字符,创建了一个无效请求,例如 /Leaflet/ms&amp;service=WMS&amp;...,但结果应该是 /Leaflet/ms?service=WMS... 尝试以下规则:

RewriteRule ^ms?(.*)$ http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map$1

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-03
    相关资源
    最近更新 更多