<WebGIS之OpenLayers全面解析>示例程序运行问题

  • 运行《WebGIS之OpenLayers全面解析》中的示例程序时,无法加载*.json文件。

查看到提示如下错误:GET http://localhost:11232/demos/data/geolocation-orientation.json 404 (NOT FOUND)

原因:

IIS服务器设置问题

1.Open IIS Manager

2.Display properties for the IIS Server

3.Click MIME Types and then add the JSON extension:

File name extension: .json

MIME type: application/json

4.Go back to the properties for IIS Server

5.Click on Handler Mappings

Add a script map

Request path: *.json

Executable: C:\WINDOWS\system32\inetsrv\asp.dll

Name: JSON

参考网址:

http://stackoverflow.com/questions/15944311/error-404-3-not-found-for-json-file

  • 无法加载kml文件

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:11232/demos/data/kml/2012_Earthquakes_Mag5.kml

在IIS中添加:KML 文件的 MIME 类型application/vnd.google-earth.kml+xml

  • 无法加载geojson文件

在IIS中添加:geojson文件的 MIME 类型application/geojson

或者在web.config文件下添加:

<system.webServer>
    <staticContent>
      <mimeMap fileExtension=".geojson" mimeType="application/geojson"/>
    </staticContent>
  </system.webServer>

  • 无法加载gpx文件

在IIS中添加:gpx文件的 MIME 类型application/gpx

posted @ 2017-03-01 17:34  kevin_cnblogs  阅读(1160)  评论(0编辑  收藏  举报