Open adikte opened 1 year ago
Hi @adikte,
Having this issue as well, have you (or anyone else) found a solution? I remember this worked on an older version.
Thanks all
edit:
it seems like this line (taken from shpwrite.js
in the npm package) was removed
var prj = (options && options.prj) ? options.prj : defaultPrj;
another edit:
building from source w/ npm run make
results in the line (2909) appearing there; don't know why that's happening
another edit:
this solution is ugly, but I went into node_modules/@mapbox/shp-write/shpwrite.js
and changed line 4188 from
zipTarget.file(fileName + ".prj", prj);
to:
zipTarget.file(fileName + ".prj", options?.prj || prj);
@adikte or @johan-cho
Can you confirm in your node_modules
which version you have installed? Did you note the change from the original package shp-write
to the new package @mapbox/shp-write
?
Here is what I have in my node_modules
folder after installing @mapbox/shp-write
in a fresh project
I also looked at a recent project I set up that uses @mapbox/shp-write
with vite
and pnpm
as my primary build tooling and digging into the output and minified JS, I can still see this line
this is what i see setup when I download from npm:
edit: similar to pnpm
Oh interesting!
I'm not sure why that is happening. I do see that in my node_modules
as well. However, when I debug through my use of shpwrite.zip(...)
inside the packaged module with my current application, I can confirm that it does have this line in it. This should be because when you import it is actually looking at the dist/index.js
file in the package repo, which simply looks at various files in src/*
. The shpwrite.js
is for browser specific use when including it as a traditional JS script (e.g. <script src='shpwrite.js'></script>
) and actually is not needed but I believe it gets automatically built when the library is installed because the make
command is called.
I think both @adikte were using the shpwrite.js
file as a traditional browser script. yeah, it's interesting that I see the line with npm run make
locally, but it doesn't exist in the unpkg or npm links.
I'm sure whenever you update the package it'll probably fix itself, but for now we have a solution and I'm satisfied.
Thanks for all your work on this package! It's really made my life easier.
Hello i am trying to make a shp file with a custom PROJCS in the file.prj but nothing seem to work. I am using shp-write@0.4.3. I tried using both shpwrite.zip and shpwrite.download with no results. Whatever i put in the options object i get the standard prj (WGS84), everything else work fine thought.
`function table_to_shapefile(source, geomType, file_name) {
}`