JavaScript
语言:
JaveScriptBabelCoffeeScript
确定
/* http://github.com/wavded/js-shapefile-to-geojson */
OpenLayers._getScriptLocation = function() {
return "http://rs1.adc4gis.com/js/openlayers/2.9.1/";
};
var starttime = +new Date,
map = new OpenLayers.Map("map", {
allOverlays: true
}),
parser = new OpenLayers.Format.GeoJSON(),
vector = new OpenLayers.Layer.Vector("Converted"),
shapefile = new Shapefile({
shp: "/uploads/shpjson/testdata/world.shp",
dbf: "/uploads/shpjson/testdata/world.dbf"
}, function(data) {
var features = parser.read(data.geojson);
vector.addFeatures(features);
map.zoomToExtent(vector.getDataExtent());
console.log("took", new Date