AnsweredAssumed Answered

python script - generating a GeoJSON file for each shp file

Question asked by ImHappy94 on Jun 11, 2020
Latest reply on Jun 13, 2020 by rvburton

I would like to write a python script in which the user enters the name of the directory with shapefile files. For each .shp file from a given directory (without checking subdirectories), the script generates a GeoJSON file in the current directory.

On the GitHub website I found a topic (https://gist.github.com/benbalter/5858851) in which someone may have written what I need:

But I need a script that first runs it, then in the console, the program asks the user for the path to the folder with the .shp files. In addition, if the GeoJSON file with the given name already exists, then before running the ogr2ogr command the program asks the user whether to overwrite it. Can you help me write such a program?

Outcomes