Untitled



In [8]:
!pip install shapely


Collecting shapely
  Downloading Shapely-1.6.1-cp36-cp36m-manylinux1_x86_64.whl (8.5MB)
    100% |████████████████████████████████| 8.5MB 138kB/s eta 0:00:01
Installing collected packages: shapely
Successfully installed shapely-1.6.1

In [7]:
import json, geojson

In [9]:
from shapely.geometry import shape

In [12]:
o = open('/home/anthonyrawlins/Documents/UoM/lfmc-staging/src/assets/vic.json', 'r').read()

In [17]:
s = json.dumps(o)

In [18]:
g1 = geojson.loads(s)

In [21]:
g2 = shape(g1)


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-21-2efe7bb2f072> in <module>()
----> 1 g2 = shape(g1)

/home/anthonyrawlins/anaconda3/lib/python3.6/site-packages/shapely/geometry/geo.py in shape(context)
     27     else:
     28         ob = context
---> 29     geom_type = ob.get("type").lower()
     30     if geom_type == "point":
     31         return Point(ob["coordinates"])

AttributeError: 'str' object has no attribute 'get'

In [ ]:
g2.wkt