mapbox / mapbox/shp-write

Prj in options does not work

Open
#115 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
321
Forks
195
PR merge metrics
No merged PRs in 30d

Description

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) {

const options = {
folder: file_name,
filename: file_name,
outputType: "blob",
compression: "DEFLATE",
prj: 'PROJCS["RGF93_v1_Lambert-93",GEOGCS["GCS_RGF93_v1",DATUM["D_Reseau_Geodesique_Francais_1993_v1",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",6600000.0],PARAMETER["Central_Meridian",3.0],PARAMETER["Standard_Parallel_1",49.0],PARAMETER["Standard_Parallel_2",44.0],PARAMETER["Latitude_Of_Origin",46.5],UNIT["Meter",1.0]]',
types: {
point: file_name,
polygon: file_name,
polyline: file_name,
}
};

// transform data to geojson
const geojson = transform_geom_geojson(source, geomType);
//shpwrite.download(geojson, options)

shpwrite.zip(geojson, options)
.then((res_zip) => {
const anchor = document.createElement('a');
anchor.href = URL.createObjectURL(res_zip);
anchor.download = file_name + '.zip';
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
})
.catch((error) => {
console.error("Erreur lors de la création du fichier ZIP", error);
});
}`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with shpwrite.zip or shpwrite.download using the supplied options object and custom prj string. Trace how the prj option is handled during shapefile generation; done means the resulting archive contains the requested custom projection instead of the standard WGS84 .prj.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.