mirror of
https://github.com/wavded/js-shapefile-to-geojson
synced 2024-11-23 06:24:55 +00:00
!-fixed issue w/ polygon holes, new testdata
This commit is contained in:
parent
b80bafe3f8
commit
8296e85e27
20
index.html
20
index.html
@ -11,18 +11,34 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="map">See Console Logs</div>
|
||||
<script src="http://rs1.adc4gis.com/js/openlayers/2.9.1/OpenLayers-Proj4.js"></script>
|
||||
<script src="stream.js"></script>
|
||||
<script src="shapefile.js"></script>
|
||||
<script src="dbf.js"></script>
|
||||
<script type="text/javascript">
|
||||
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: "testdata/testshape.shp",
|
||||
dbf: "testdata/testshape.dbf"
|
||||
shp: "testdata/world.shp",
|
||||
dbf: "testdata/world.dbf"
|
||||
}, function(data){
|
||||
var features = parser.read(data.geojson);
|
||||
vector.addFeatures(features);
|
||||
map.zoomToExtent(vector.getDataExtent());
|
||||
|
||||
console.log("took",new Date - starttime,"milliseconds")
|
||||
console.log(data);
|
||||
})
|
||||
|
||||
map.addLayer(vector);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -290,7 +290,8 @@
|
||||
part = [],
|
||||
point
|
||||
|
||||
for (var p = partIndex; p < (partIndex[pt+1] || points.length); p++){
|
||||
// partIndex 0 == main poly, partIndex > 0 == holes in poly
|
||||
for (var p = partIndex; p < (parts[pt+1] || points.length); p++){
|
||||
point = points[p]
|
||||
part.push([point.x,point.y])
|
||||
}
|
||||
|
BIN
testdata/testshape.dbf
vendored
BIN
testdata/testshape.dbf
vendored
Binary file not shown.
BIN
testdata/testshape.shp
vendored
BIN
testdata/testshape.shp
vendored
Binary file not shown.
BIN
testdata/world.dbf
vendored
Normal file
BIN
testdata/world.dbf
vendored
Normal file
Binary file not shown.
BIN
testdata/world.shp
vendored
Normal file
BIN
testdata/world.shp
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user