Csv to points
In [1]:
import os
import geodemo
In [2]:
m = geodemo.Map()
m
In [3]:
in_csv = "data/world_cities.csv"
In [4]:
m.add_points_from_csv(in_csv, label='name')
In [5]:
out_dir = os.path.expanduser("~/Downloads")
if not os.path.exists(out_dir):
os.makedirs(out_dir)
In [6]:
out_shp = os.path.join(out_dir, "cities.shp")
In [7]:
geodemo.csv_to_shp(in_csv, out_shp, x="longitude", y="latitude")
In [8]:
out_geojson = os.path.join(out_dir, "cities.geojson")
In [9]:
geodemo.csv_to_geojson(in_csv, out_geojson, x="longitude", y="latitude")
Last update: 2021-05-07