Zip.js function does not work on a angular implementation of the project
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- angular, javascript
- Domain
- frontend
Research direction
Start by inspecting src/zip.js at line 33 and follow how src/download.js invokes it when imported from an Angular application. Reproduce the reported ReferenceError with the shown shp.download call, then verify that the browser download completes without the process error.
Written by the indexing model from the issue text.
Description
Hi guys, the zip function inside zip.js does not work in a angular implementation of this package, it returns the following error:
MeusMapasDetailComponent.html:497 ERROR ReferenceError: process is not defined
at push../node_modules/shp-write/src/zip.js.module.exports (zip.js:33)
at Object.push../node_modules/shp-write/src/download.js.module.exports [as download] (download.js:4)
at MeusMapasDetailComponent.push../src/app/cliente-basico/modules/meus-mapas/detail/detail.component.ts.MeusMapasDetailComponent.exportshp (detail.component.ts:908)
at Object.eval [as handleEvent] (MeusMapasDetailComponent.html:497)
at handleEvent (core.js:23107)
at callWithDebugContext (core.js:24177)
at Object.debugHandleEvent [as handleEvent] (core.js:23904)
at dispatchEvent (core.js:20556)
at core.js:21003
at HTMLButtonElement.<anonymous> (platform-browser.js:993)
My current implementation
import * as shp from 'shp-write';
getSingleGeoJson(){
var selectedPoligon = this.allDrawnItems.getLayer(this.ultimoPoligonoSelecionado.target._leaflet_id);
var newPoli = L.polygon(selectedPoligon["_latlngs"][0],
{
color: '#1DB954',
fillColor: '#1DB954',
fillOpacity: 0.2
}
).addTo(this.singlePolygonGroupLayer);
return this.singlePolygonGroupLayer.toGeoJSON();
}
exportshp() {
var options = {
folder: 'myshapes',
types: {
point: 'mypoints',
polygon: 'mypolygons',
line: 'mylines'
}
}
shp.download(this.getSingleGeoJson(), options);
}
What i found out
After messing arround i found that the error is in line 33 of the zip.js file inside src, where is has:
if (!process.browser) {
generateOptions.type = 'nodebuffer';
}
since theres no process being set, because the method is being called by a angular project, the download does not happens.
- Dominant language
- JavaScript
- Stars
- 321
- Forks
- 193
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mapbox/shp-write
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
how to use write() ?Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
-
corrupted charactersOpen
Difficulty 3/5 1-2 days Newbie friendliness 15/100
All issues in mapbox/shp-write
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
jspreadsheet/ce#1809 ·
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
githubnext/gh-aw-workshop#4458 ·
Maintainers usually reply within 1 day
-
Add: CartoonitoOpencheck:failed feeds:add
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
iptv-org/database#37390 · 1 comment ·
Maintainers usually reply within 9 days
-
bug: directory index route root priority is overwritten when wildcard is falsePossibly taken @TalhaHunter101 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
fastify/fastify-static#617 ·
-
bug confirmed css v6
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day