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:
parent
907d16da83
commit
db9bfd55d8
26
readme.md
26
readme.md
@ -23,36 +23,36 @@ You can use it to parse shapefiles (.shp) or dBase files (.dbf) or both. Here a
|
|||||||
|
|
||||||
Load Shapefile Only
|
Load Shapefile Only
|
||||||
|
|
||||||
var shapefile = new Shapefile("myshapefile.shp",function(data){
|
new Shapefile("myshapefile.shp", function (data) {
|
||||||
// data returned
|
// data returned
|
||||||
};
|
});
|
||||||
|
|
||||||
Load DBF Only
|
Load DBF Only
|
||||||
|
|
||||||
var dbf = new DBF("mydbf.dbf",function(data){
|
new DBF("mydbf.dbf", function (data) {
|
||||||
// data returned
|
// data returned
|
||||||
};
|
});
|
||||||
|
|
||||||
Load Shapefile w/ DBF Attributes
|
Load Shapefile w/ DBF Attributes
|
||||||
|
|
||||||
var shapefile = new Shapefile({
|
new Shapefile({
|
||||||
shp: "myshape.shp",
|
shp: "myshape.shp",
|
||||||
dbf: "myshape.dbf"
|
dbf: "myshape.dbf"
|
||||||
}, function(data){
|
}, function (data) {
|
||||||
// data returned
|
// data returned
|
||||||
};
|
});
|
||||||
|
|
||||||
Use with OpenLayers
|
Use with OpenLayers
|
||||||
|
|
||||||
var
|
var parser = new OpenLayer.Format.GeoJSON(),
|
||||||
parser = new OpenLayer.Format.GeoJSON(),
|
features;
|
||||||
features,
|
|
||||||
shapefile = new Shapefile({
|
new Shapefile({
|
||||||
shp: "myshape.shp",
|
shp: "myshape.shp",
|
||||||
dbf: "myshape.dbf"
|
dbf: "myshape.dbf"
|
||||||
}, function(data){
|
}, function (data) {
|
||||||
features = parser.read(data.geojson);
|
features = parser.read(data.geojson);
|
||||||
};
|
});
|
||||||
|
|
||||||
### Resources
|
### Resources
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user