mapbox / shp-write

create and write to shapefiles in pure javascript
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

Issue with naming of Poly Line #109

Open devanshubisht opened 10 months ago

devanshubisht commented 10 months ago
  [
    geojson.point(gj),
    geojson.line(gj),
    geojson.polygon(gj),
    geojson.multipolygon(gj),
    geojson.multiline(gj),
  ].forEach(function (l) {
    if (l.geometries.length && l.geometries[0].length) {
      write(
        // field definitions
        l.properties,
        // geometry type
        l.type,
        // geometries
        l.geometries,
        function (err, files) {
          var fileName =
            options && options.types && options.types[l.type.toLowerCase()]
              ? options.types[l.type.toLowerCase()]
              : l.type;
          zipTarget.file(fileName + ".shp", files.shp.buffer, { binary: true });
          zipTarget.file(fileName + ".shx", files.shx.buffer, { binary: true });
          zipTarget.file(fileName + ".dbf", files.dbf.buffer, { binary: true });
          zipTarget.file(fileName + ".prj", prj);
        }
      );
    }
  });

When a geojson with linestring is being added, the shp type returned is polyline. But there is no option to edit the polyline name under shpwritedownloadoptions/zip optiosn

  export interface DownloadOptions {
    folder?: string;
    filename?: string;
    prj?: string;
    types?: {
      point?: string;
      polygon?: string;
      line?: string;
      multipolygon?: string;
      multiline?: string;
    };
  }
devanshubisht commented 10 months ago
  export interface DownloadOptions {
    folder?: string;
    filename?: string;
    prj?: string;
    types?: {
      point?: string;
      polygon?: string;
      polyline?: string;
      multipolygon?: string;
      multiline?: string;
    };
  }

Changing this would work, isit possible to add such changes?