Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error importing Polygon from shapely.geometry.polygon

In my Anaconda 2.2 64bit with Python 3.4.3 the following line works well:

import shapely

But the following line:

from shapely.geometry.polygon import Polygon

returns the following error:

OSError: [WinError 126] The specified module could not be found

What am I missing?

EDIT

I tried with iNotebook, idle.exe and Eclipse. They all use Anaconda (the only Python installation on my computer) and they all show the same error.

If I type from shapely.geometry import Polygon in Eclipse, then I click on Polygon, then I press F3, Eclipse is able to open the module C:\Anaconda3\Lib\site-packages\shapely\geometry\polygon.py. So Eclipse is able to find it, but the execution fails.

EDIT 2

I just tried the same import on another computer with similar configuration and it works. The "only" difference between the two computers is that one has Windows 7 (it works) and one has Windows 8 (it doesn't).

I installed Anaconda and a few packages in both the computers following the same old checklist. The computer with Windows 8 can see the package from Eclipse, but can't import it.

like image 837
stenci Avatar asked Apr 27 '15 19:04

stenci


People also ask

What is shapely geometry in Python?

Shapely is a BSD-licensed Python package for manipulation and analysis of planar geometric objects. It is based on the widely deployed GEOS (the engine of PostGIS) and JTS (from which GEOS is ported) libraries.

How do you convert Linestring to polygons?

geometry. Polygon to simply convert to line string to a polygon. It will connect the first and last coordinates. Try Polygon([(0, 0), (1, 1), (1, 2), (0, 1)]) or Polygon(s1) to produce POLYGON ((0 0, 1 1, 1 2, 0 1, 0 0)).

Is Point in polygon shapely?

Shapely is an offshoot of the GIS-Python project that provides spatial geometry functions independent of any geo-enabled database. In particular, it makes python point-in-polygon calculations very easy.


1 Answers

Try with below one, it solved the issue for me (Windows 10):

conda install -c conda-forge shapely

shapely package docs

like image 61
rmswrp Avatar answered Sep 27 '22 17:09

rmswrp