geo




Pay Notebook Creator: Noe Dominguez0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [1]:
import geotable
In [2]:
t = geotable.load('line.geojson')
In [4]:
t.draw()
Out[4]:
<geotable.ColorfulGeometryCollection at 0x7f0cf67b66d8>
In [8]:
from shapely.geometry import GeometryCollection
In [9]:
gc = GeometryCollection(t.geometries)
In [11]:
gc.bounds
Out[11]:
(-79.71827225092947, 36.13830085783994, -79.49956870558653, 36.30469203650488)
In [12]:
t[:3]
Out[12]:
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style>
id width geometry_object geometry_layer geometry_proj4
0 l0 1.0 LINESTRING (-79.65685579971908 36.179729572899... OGRGeoJSON +proj=longlat +datum=WGS84 +no_defs
1 l1 1.0 LINESTRING (-79.6566281613333 36.1829669781104... OGRGeoJSON +proj=longlat +datum=WGS84 +no_defs
2 l2 1.0 LINESTRING (-79.65571153788883 36.182920627332... OGRGeoJSON +proj=longlat +datum=WGS84 +no_defs
In [18]:
t['geometry_object'][3]
Out[18]:
<shapely.geometry.linestring.LineString at 0x7f0cc54e3518>
In [19]:
from shapely.geometry import box
In [20]:
b = box(-79.656855, 36.18200, -79.50, 36.31)
In [21]:
gc.intersection(b)
Out[21]:
<shapely.geometry.multilinestring.MultiLineString at 0x7f0ca19bb5c0>
In [ ]: