Getting KML layer to work locally (e.g. the Google

2019-08-02 14:41发布

I have copied all of the files for the Google example http://gmaps-samples-v3.googlecode.com/svn/trunk/toomanymarkers/toomanymarkers.html to my PC, but the KML layer does not appear when I tick the checkbox.

The files I copied are:

  • functions.js
  • markers.js
  • markers.kml
  • toomanymarkers.html

I have also copied these to http://www.performit.co.uk/misc/maps/toomanymarkers/toomanymarkers.html and it doesn't work there either.

Am I missing something? Do I need to have an environment set up for the files to load?

2条回答
来,给爷笑一个
2楼-- · 2019-08-02 15:05

The KML file must be publicly accessible via the web, so this will not work if you are developing locally. Google accesses and processes the file, returning that data as location, zoom level, markers, polylines, polygons, etc.

What is the actual URL to your KML file? Copy that, and past it into the Search Maps box of GoogleMaps. If it's valid KML, GM will process it and display your KML data.

查看更多
【Aperson】
3楼-- · 2019-08-02 15:21

It appears to be a web server configuration issue. When I try to access http://www.performit.co.uk/misc/maps/toomanymarkers/markers.kml, I get a 500 server error. It appears to me that functions.js tries to access that URL. So, I'd look into that. By comparison, http://gmaps-samples-v3.googlecode.com/svn/trunk/toomanymarkers/toomanymarkers.html happily serves up the KML file.

查看更多
登录 后发表回答