%matplotlib inline
import geopandas as gpd
import pandas as pd
import pysal as ps
db = gpd.read_file(ps.examples.get_path('NAT.shp'))
db.plot();
! rm test.geojson
%time db.to_file('test.geojson', driver='GeoJSON')
rm: test.geojson: No such file or directory CPU times: user 9.98 s, sys: 114 ms, total: 10.1 s Wall time: 10.7 s
%%time
db['geometry'] = db['geometry'].apply(lambda x: x.wkb_hex)
db.to_feather('test.feather')
CPU times: user 408 ms, sys: 19.5 ms, total: 428 ms Wall time: 430 ms
%time gjs = gpd.read_file('test.geojson', driver='GeoJSON')
gjs.plot();
CPU times: user 1.87 s, sys: 84.5 ms, total: 1.96 s Wall time: 1.94 s
%time gjs = gpd.read_file('test.shp')
gjs.plot();
CPU times: user 602 ms, sys: 19 ms, total: 621 ms Wall time: 618 ms
from shapely.wkb import loads
%%time
ftr = pd.read_feather('test.feather')
ftr['geometry'] = ftr['geometry'].apply(lambda x: loads(x, hex=True))
ftr = gpd.GeoDataFrame(ftr)
CPU times: user 244 ms, sys: 5.66 ms, total: 250 ms Wall time: 249 ms
ftr.plot();