Instantly share code, notes, and snippets.
Created from this file like this: https://gist.github.com/simonw/53ad57ad42c7efe75e2028d975907180
import json # Load the JSON data from the file file_path = '/mnt/data/places.json' with open(file_path, 'r') as file: data = [json.loads(line) for line in file] # Convert to GeoJSON manually geojson_data = { "type": "FeatureCollection", "features": [] } for place in data: feature = { "type": "Feature", "geometry": { "type": "Point", "coordinates": [place['longitude'], place['latitude']] }, "properties": {k: v for k, v in place.items() if k not in ['latitude', 'longitude']} } geojson_data["features"].append(feature) # Save the GeoJSON data to a file output_path = '/mnt/data/places.geojson' with open(output_path, 'w') as geojson_file: json.dump(geojson_data, geojson_file) output_path
Code by ChatGPT Code Interpreter: https://chatgpt.com/share/673d7b92-0b4c-8006-a442-c5e6c2713d9c
Sorry, something went wrong.
Created from this file like this: https://gist.github.com/simonw/53ad57ad42c7efe75e2028d975907180
Code by ChatGPT Code Interpreter: https://chatgpt.com/share/673d7b92-0b4c-8006-a442-c5e6c2713d9c