要将外部GeoJSON文件加载到Leaflet地图中?
我想将geoJSON(多边形)文件加载到我的传单地图中。我已经看到了将geoJSON嵌入到javascript代码中的示例,但是找不到任何示例来说明如何使用外部文件来完成它。 <head> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" /> <script src="usStates.geojson" type="text/javascript"></script> <style> html, body, #map { height: 100%; } body { padding: 0; margin: 0; } </style> </head> <body> <div id="map" style="height: 100%"</div> <script src="http://d3js.org/d3.v2.min.js?2.9.3"></script> <script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script> <script type="text/javascript"> var map = L.map('map').setView([38.57, -94.71], 4); L.tileLayer('http://{s}.tile.cloudmade.com/9067860284bc491e92d2342cc51d47d9/998/256/{z}/{x}/{y}.png', …