I have a csv with 6 millions of rows and i need to convert it to a geojson file.
cloud solutions exists in the internet but it takes whole day to convert it.
Is there a quick way to do that with python ?
UPDATE OF QUESTION :
i tried the solution here but i'm getting this error :
ValueError Traceback (most recent call last)
<ipython-input-48-0224e45ed66e> in <module>()
5 with open('Documents/neo4j-community-3.3.5/import/train.csv', newline='') as csvfile:
6 reader = csv.reader(csvfile, delimiter=',')
----> 7 for pickup_latitude, pickup_longitude in reader:
8 pickup_latitude,pickup_longitude = map(float, (pickup_latitude, pickup_longitude))
9 features.append(
ValueError: too many values to unpack (expected 2)
this is my code :
import csv, json
from geojson import Feature, FeatureCollection, Point
features = []
with open('Documents/neo4j-community-3.3.5/import/train.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
for pickup_latitude, pickup_longitude in reader:
pickup_latitude,pickup_longitude = map(float, (pickup_latitude, pickup_longitude))
features.append(
Feature(
geometry = Point((pickup_longitude, pickup_latitude)),
)
)
collection = FeatureCollection(features)
with open("GeoObs.json", "w") as f:
f.write('%s' % collection)
Note :pickup_latitude and pickup_longitude are two columns in my csv