Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I select a .shp + .dbf + .shx file to upload? #38

Open
ahalota opened this issue May 18, 2016 · 1 comment
Open

Can I select a .shp + .dbf + .shx file to upload? #38

ahalota opened this issue May 18, 2016 · 1 comment

Comments

@ahalota
Copy link

ahalota commented May 18, 2016

I'd like to offer my users to upload these 3 files instead of having to compress it into .zip first. Does the library currently already allow this?

The other solution I had in mind is to have them select all three, I zip them up on my end, and then proceed as usual.

@calvinmetcalf
Copy link
Owner

not with this library, but you can use shapefile-js to parse the shp and dbf seperatlly and combine them, with code like

shp.combine([shp.parseShp(shpFile), dbfFile]).then(function (geojson) {
  var layer =  L.geojson(geojson).addTo(map);
});

the shx file is not required, but if your shapefile is projected you need to have the .proj file and you can use it as such

shp.combine([shp.parseShp(shpFile, projFile), dbfFile]).then(function (geojson) {
  var layer =  L.geojson(geojson).addTo(map);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants