mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.74k stars 532 forks source link

Export to Shape File Not working #641

Closed MapUser2024 closed 4 months ago

MapUser2024 commented 4 months ago

I import a GeoJson and try to export to SHP (used to work fine) and it has an error. Something to do with .prj and basemap issue?

mbloch commented 4 months ago

I'll need some more info to help me troubleshoot this issue. I just tested GeoJSON to Shapefile conversion in the web UI and my simple test worked correctly.

I have a few questions. Can you send me the GeoJSON file that is causing the problem? Are you doing anything other than importing the GeoJSON and then using the Export menu to export as Shapefile? How does the basemap feature seem to be involved? Thanks!

MapUser2024 commented 4 months ago

Just importing a GeoJSON as I always have before. Select_Tax Parcels (2).zip

MapUser2024 commented 4 months ago

image

mbloch commented 4 months ago

The file I downloaded from the link you pasted (https://github.com/mbloch/mapshaper/files/15255958/Select_Tax.Parcels.2.zip) isn't a valid .zip file, it appears to have size 0. Can you check your data file and try uploading again?

I see you're on Windows -- I develop mapshaper on a Mac, but I can use Windows in an emulator. I tested mapshaper's GeoJSON importing and Shapefile exporting on Windows using both Edge and Chrome browsers, it worked correctly with my sample file.

MapUser2024 commented 4 months ago

My bad on the zip file.... I could not load the GeoJSON as this platform says that is an invalid file format.

image

MapUser2024 commented 4 months ago

Tried changing the name to *.JSON. Still the same result. I will upload that file with the changed extension to see if that makes any difference. It may be the file on my end. Not sure.

image

MapUser2024 commented 4 months ago

Select_Tax Parcels (1).json

MapUser2024 commented 4 months ago

Thanks for your help. It would not surprise me if something is going on with our GIS database. But it worked fine even just a couple of months ago.

mbloch commented 4 months ago

Thanks for posting the data file, now I can see what's happening. If I drop the file into mapshaper and right-click, I get the map coordinates at the mouse position: image

The size of the coordinates tells me that the GeoJSON file contains projected coordinates, not latitude-longitude coordinates. The GeoJSON standard committee dropped support for projected coordinates in 2016, and Mapshaper does not fully support old-style GeoJSON with projected coordinates, but there is a workaround that will let you use this file.

Looking at the GeoJSON code, I see that the file is using the EPSG:2927 CRS (one of the state plane coordinate systems). After loading the file into mapshaper, you can open the console and type proj init=EPSG:2927, like this:

image

After this, your file is properly georeferenced, and you can export it as a Shapefile.

MapUser2024 commented 4 months ago

That worked, sort of. Now it says, image

mbloch commented 4 months ago

I can't tell why it is erroring -- your sample file saved correctly for me. I exported to Shapefile both from the Export menu and using the console. Pasted below is a screenshot of the console, showing the commands that I ran. If you want me look into the reason for "Save failed...", you can open the browser's developer console, there will be a more detailed error message there that you could screenshot and send to me.

image

MapUser2024 commented 4 months ago

This is resolved. I normally use Opera. I had tried the to get this to work in Edge before as well, but with the command for the console and using Edge, that resolved the problem. Thanks again for your time and attention to detail.