calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
714 stars 228 forks source link

Coordinates gets modified while converting shapefile to geojson #176

Open raj1258 opened 2 years ago

raj1258 commented 2 years ago

While reading a shape file many coordinates gets modified because of addition of some extra decimal digits. for ex: image 'coStr" is the exact coordinates in the shapefile. but, "Geocoordinates" which i got from geometry after converting to geojson features, has been modified.

calvinmetcalf commented 2 years ago

this is because JavaScript only has double precise floating points for numbers not true decimals so it can't represent all decimal fractions perfectly, you can read more here https://0.30000000000000004.com/

raj1258 commented 2 years ago

I exported the shapefile to geojson using mapshaper and shapefile js. I got the correct coordinates. image I think, it can be handled here also.

raj1258 commented 2 years ago

178