Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 596
Anthony Milano Avatar asked Sep 26 '26 18:09

Anthony Milano


1 Answers

You could use one of these:

import shapely.geometry

or

from shapely import geometry
like image 90
Mike T Avatar answered Sep 28 '26 06:09

Mike T



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!