MapServer и OpenLayers: не открывается карта
Добавлено: 09 апр 2013, 12:15
Здравствуйте!
Помогите, пожалуйста! Не получается отобразить карту через WMS на OpenLayers
Создала map-файл для поддержки WMS (sip.map):
В браузере карта открывается по ссылке http://localhost/cgi-bin/mapserv.exe?ma ... f&mode=map
WMS-сервис дает следующий ответ, т.е. вроде бы работает.
Подключаю WMS через OpenLayers, слой называется relief (подложки нет, пытаюсь получить только один этот слой):
В результате вижу только белый экран
Подскажите, пожалуйста, в чем ошибка
Все описанные файлы и шейп-файлы прилагаю во вложении
Помогите, пожалуйста! Не получается отобразить карту через WMS на OpenLayers
Создала map-файл для поддержки WMS (sip.map):
Код: Выделить всё
MAP
NAME "WMS"
STATUS ON
IMAGETYPE PNG
EXTENT 667190.161507 5580041.069265 719229.643505 5623106.149870
SIZE 800 500
SHAPEPATH "/ms4w/apps/sip/shp/"
IMAGECOLOR 255 255 255
PROJECTION
"proj=latlong"
"ellps=WGS84"
"datum=WGS84"
END
WEB
TEMPLATE './templates/template.html'
IMAGEPATH '/ms4w/tmp/ms_tmp/'
IMAGEURL '/ms_tmp/'
METADATA
wms_title "Test"
wms_abstract "This is the test"
wms_onlineresource "http://localhost/cgi-bin/mapserv.exe?map=d:/ms4w/apps/sip/sip.map&"
wms_srs "EPSG:4326"
wms_getfeatureinfo "http://localhost/cgi-bin/mapserv.exe?map=d:/ms4w/apps/sip/sip.map&"
wms_featureinfoformat "text/plain"
wms_enable_request "*"
END
END
LAYER
NAME "relief"
DATA relief
STATUS ON
PROJECTION
"proj=latlong"
"ellps=WGS84"
"datum=WGS84"
END
TYPE LINE
CLASS
NAME "Рельеф"
STYLE
COLOR 12 12 12
END
END
METADATA
wms_title "Countries 1"
wms_abstract "Countries 1 test"
wms_srs "EPSG:4326"
wms_include_items "all"
wms_enable_request "*"
END
END
END
WMS-сервис дает следующий ответ, т.е. вроде бы работает.
Код: Выделить всё
<?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"
[
<!ELEMENT VendorSpecificCapabilities EMPTY>
]> <!-- end of DOCTYPE declaration -->
<WMT_MS_Capabilities version="1.1.1">
<!-- MapServer version 6.0.3 (MS4W 3.0.6) OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE 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 INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
<Service>
<Name>OGC:WMS</Name>
<Title>GIS-LAB Demo</Title>
<Abstract>This is the WMS demo from GIS-Lab</Abstract>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/>
<ContactInformation>
</ContactInformation>
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>application/vnd.ogc.wms_xml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Post>
</HTTP>
</DCPType>
</GetCapabilities>
<GetMap>
<Format>image/png</Format>
<Format>image/jpeg</Format>
<Format>image/gif</Format>
<Format>image/png; mode=8bit</Format>
<Format>application/x-pdf</Format>
<Format>image/svg+xml</Format>
<Format>image/tiff</Format>
<Format>application/vnd.google-earth.kml+xml</Format>
<Format>application/vnd.google-earth.kmz</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Post>
</HTTP>
</DCPType>
</GetMap>
<GetFeatureInfo>
<Format>text/plain</Format>
<Format>application/vnd.ogc.gml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Post>
</HTTP>
</DCPType>
</GetFeatureInfo>
<DescribeLayer>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Post>
</HTTP>
</DCPType>
</DescribeLayer>
<GetLegendGraphic>
<Format>image/png</Format>
<Format>image/jpeg</Format>
<Format>image/gif</Format>
<Format>image/png; mode=8bit</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Post>
</HTTP>
</DCPType>
</GetLegendGraphic>
<GetStyles>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Get>
<Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&"/></Post>
</HTTP>
</DCPType>
</GetStyles>
</Request>
<Exception>
<Format>application/vnd.ogc.se_xml</Format>
<Format>application/vnd.ogc.se_inimage</Format>
<Format>application/vnd.ogc.se_blank</Format>
</Exception>
<VendorSpecificCapabilities />
<UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0"/>
<Layer>
<Name>WMS</Name>
<Title>GIS-LAB Demo</Title>
<Abstract>This is the WMS demo from GIS-Lab</Abstract>
<SRS>EPSG:4326</SRS>
<LatLonBoundingBox minx="667190" miny="5.58004e+006" maxx="719230" maxy="5.62311e+006" />
<BoundingBox SRS=""
minx="667190" miny="5.58004e+006" maxx="719230" maxy="5.62311e+006" />
<Layer queryable="0" opaque="0" cascaded="0">
<Name>relief</Name>
<Title>Countries 1</Title>
<Abstract>Countries 1 test</Abstract>
<SRS>EPSG:4326</SRS>
<LatLonBoundingBox minx="667190" miny="5.58004e+006" maxx="719230" maxy="5.62311e+006" />
<BoundingBox SRS="EPSG:4326"
minx="667190" miny="5.58004e+006" maxx="719230" maxy="5.62311e+006" />
<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL width="71" height="21">
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost/cgi-bin/mapserv.exe??map=d:/ms4w/apps/sip/sip.map&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=relief&format=image/png&STYLE=default"/>
</LegendURL>
</Style>
</Layer>
</Layer>
</Capability>
</WMT_MS_Capabilities>
Код: Выделить всё
<html>
<head>
<title>OpenLayers</title>
<script
src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS(
"wms",
"http://localhost/cgi-bin/mapserv.exe?map=d:/ms4w/apps/sip/sip.map",
{map: '/ms4w/apps/sip/sip.map', layers: 'relief', transparent: 'true', format: 'image/png'});
map.addLayer(wms);
</script>
</body>
</html>
Подскажите, пожалуйста, в чем ошибка
Все описанные файлы и шейп-файлы прилагаю во вложении