1
0
mirror of https://github.com/wavded/js-shapefile-to-geojson synced 2024-11-23 14:34:54 +00:00

updated; code samples

This commit is contained in:
Marc Harter 2013-08-26 16:58:35 -05:00
parent 907d16da83
commit db9bfd55d8

View File

@ -23,36 +23,36 @@ You can use it to parse shapefiles (.shp) or dBase files (.dbf) or both. Here a
Load Shapefile Only
var shapefile = new Shapefile("myshapefile.shp",function(data){
new Shapefile("myshapefile.shp", function (data) {
// data returned
};
});
Load DBF Only
var dbf = new DBF("mydbf.dbf",function(data){
new DBF("mydbf.dbf", function (data) {
// data returned
};
});
Load Shapefile w/ DBF Attributes
var shapefile = new Shapefile({
new Shapefile({
shp: "myshape.shp",
dbf: "myshape.dbf"
}, function(data){
}, function (data) {
// data returned
};
});
Use with OpenLayers
var
parser = new OpenLayer.Format.GeoJSON(),
features,
shapefile = new Shapefile({
var parser = new OpenLayer.Format.GeoJSON(),
features;
new Shapefile({
shp: "myshape.shp",
dbf: "myshape.dbf"
}, function(data){
}, function (data) {
features = parser.read(data.geojson);
};
});
### Resources