1

Is there a way to remove the m value and the z value from a shapefile using JavaScript "leafletjs & shpjs”?

5
  • 1
    What exactly do you mean by removing those values? – TomazicM Jun 14 at 14:11
  • I have 2 shapefiles 1st one M value and Z value are checked in arcmap and the 2nd one they are not checked, for the 1st it does not appear with leaflet but the 2nd appear, so im searching for a way to remove those values from the shp – Salah ED Jun 14 at 14:17
  • Shapefiles have 2-4 values per vertex -- X and Y are mandatory; the Z and M are optional, but only optional for the entire shapefile. You would need to completely rewrite the shapefile to remove Z and/or M dimensions (this cannot be done in-situ in most interfaces). – Vince Jun 14 at 16:12
  • Using just the packages you mentioned? I don't think so. Neither seem to write to shape. You'll most likely need to convert from shp to GeoJSON, and then parse the GeoJSON (drop z's), and write to a new "z-not-enabled shapefile". But you'll need a package that writes to SHP. A quick search finds: stackoverflow.com/questions/62544929/… (with good links in the unanswered question) – KHibma Jun 14 at 16:24
  • You won't need to do this. See my answer to your question that is reason for this question: gis.stackexchange.com/questions/401426/… – TomazicM Jun 14 at 19:12