Anthony Milano
Anthony Milano

Reputation: 33

Python Shapely Install Not working?

any thoughts? I've tried uninstalling Shapely and installing with PIP I have Anaconda and installed Fiona fine and Shapely seemingly fine. Simple code:

import fiona
import shapely

dirVar = "C:\\Users\\me\\Desktop\\geocode\\"

with fiona.open(dirVar + "Regions.shp") as fiona_collection:

    shapefile_record = fiona_collection.next()
    shape = shapely.geometry.asShape(shapefile_record['geometry']) #GET ERROR HERE

    point = shapely.geometry.Point(32.398516, -39.754028) # longitude, latitude

    if shape.contains(point):
        print "Found shape for point."

AttributeError: 'module' object has no attribute 'geometry'

When I look at the methods of shapely from Wing IDE I see only:

ctypes_declarations
ftools
geos

I would think I should see geometry if it was installed correctly?

Any thoughts?

Upvotes: 3

Views: 6322

Answers (1)

Mike T
Mike T

Reputation: 43692

You could use one of these:

import shapely.geometry

or

from shapely import geometry

Upvotes: 5

Related Questions