shapely

Python can't import shapely

梦想与她 提交于 2019-12-01 13:17:57
I am using Python3.4 on Mac OSX and I am trying to import shapely. I am however unable to do so. Here is my traceback: from shapely.geometry import Point File "/Users/tc9/Library/Python/3.4/lib/python/site-packages/shapely/geometry/__init__.py", line 4, in <module> from .base import CAP_STYLE, JOIN_STYLE File "/Users/tc9/Library/Python/3.4/lib/python/site-packages/shapely/geometry/base.py", line 9, in <module> from shapely.coords import CoordinateSequence File "/Users/tc9/Library/Python/3.4/lib/python/site-packages/shapely/coords.py", line 8, in <module> from shapely.geos import lgeos File "

Python can't import shapely

独自空忆成欢 提交于 2019-12-01 11:53:57
问题 I am using Python3.4 on Mac OSX and I am trying to import shapely. I am however unable to do so. Here is my traceback: from shapely.geometry import Point File "/Users/tc9/Library/Python/3.4/lib/python/site-packages/shapely/geometry/__init__.py", line 4, in <module> from .base import CAP_STYLE, JOIN_STYLE File "/Users/tc9/Library/Python/3.4/lib/python/site-packages/shapely/geometry/base.py", line 9, in <module> from shapely.coords import CoordinateSequence File "/Users/tc9/Library/Python/3.4

Splitting self-intersecting polygon only returned one polygon in Shapely

怎甘沉沦 提交于 2019-12-01 05:26:01
I am using Python 3.5 64 bit in Windows 7 64 bit, shapely version 1.5.13. I have the following code that returned me a self-intersecting polygon: import numpy as np from shapely.geometry import Polygon, MultiPolygon import matplotlib.pyplot as plt x = np.array([ 0.38517325, 0.40859912, 0.43296919, 0.4583215 , 0.4583215 , 0.43296919, 0.40859912, 0.38517325, 0.36265506, 0.34100929]) y = np.array([ 62.5 , 56.17977528, 39.39698492, 0. , 0. , 17.34605377, 39.13341671, 60.4180932 , 76.02574417, 85.47008547]) polygon = Polygon(np.c_[x, y]) plt.plot(*polygon.exterior.xy) This is correct. Then I tried

Pandas apply to dateframe produces '<built-in method values of …'

旧城冷巷雨未停 提交于 2019-12-01 03:36:45
I'm trying to build a GeoJSON object . My input is a csv with an address column, a lat column, and a lon column. I then created Shapely points out of the coordinates , buffer them out by a given radius, and get the dictionary of coordinates via the mapping option- so far, so good. Then, after referring to this question , I wrote the following function to get a Series of dictionaries: def make_geojson(row): return {'geometry':row['geom'], 'properties':{'address':row['address']}} and I applied it thusly: data['new_output'] = data.apply(make_geojson, axis=1) My resulting column is full of these:

Splitting self-intersecting polygon only returned one polygon in Shapely

故事扮演 提交于 2019-12-01 03:21:38
问题 I am using Python 3.5 64 bit in Windows 7 64 bit, shapely version 1.5.13. I have the following code that returned me a self-intersecting polygon: import numpy as np from shapely.geometry import Polygon, MultiPolygon import matplotlib.pyplot as plt x = np.array([ 0.38517325, 0.40859912, 0.43296919, 0.4583215 , 0.4583215 , 0.43296919, 0.40859912, 0.38517325, 0.36265506, 0.34100929]) y = np.array([ 62.5 , 56.17977528, 39.39698492, 0. , 0. , 17.34605377, 39.13341671, 60.4180932 , 76.02574417, 85

Pandas apply to dateframe produces '<built-in method values of …'

谁说胖子不能爱 提交于 2019-12-01 00:17:09
问题 I'm trying to build a GeoJSON object. My input is a csv with an address column, a lat column, and a lon column. I then created Shapely points out of the coordinates , buffer them out by a given radius, and get the dictionary of coordinates via the mapping option- so far, so good. Then, after referring to this question, I wrote the following function to get a Series of dictionaries: def make_geojson(row): return {'geometry':row['geom'], 'properties':{'address':row['address']}} and I applied it

Shapely地理空间几何库,使用手册(英)

北慕城南 提交于 2019-11-30 21:35:20
The Shapely User Manual Author: Sean Gillies, < sean.gillies@gmail.com > Version: 1.2 and 1.3 Date: December 31, 2013 Copyright: This work is licensed under a Creative Commons Attribution 3.0 United States License . Abstract: This document explains how to use the Shapely Python package for computational geometry. Introduction Deterministic spatial analysis is an important component of computational approaches to problems in agriculture, ecology, epidemiology, sociology, and many other fields. What is the surveyed perimeter/area ratio of these patches of animal habitat? Which properties in this

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

China☆狼群 提交于 2019-11-30 17:19:04
I have to install Shapely package ( http://toblerity.org/shapely/project.html#installation ). But when I am using: pip install Shapely I am getting this error: Collecting Shapely Using cached Shapely-1.5.17.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\setup.py", line 38, in <module> from shapely._buildcfg import geos_version_string, geos_version, \ File "C:\Users\AppData\Local\Temp\pip-build-mwuxcain\Shapely\shapely\_buildcfg.py", line 200, in

Python, GEOS and Shapely on Windows 64

你离开我真会死。 提交于 2019-11-30 17:16:54
When trying to install Shapely on my Windows 64bit computer, I cannot get the GEOS library to work. So far, I have run the OSGeo4W installer from which I installed GDAL (I believe the geos library is included in that package). After that, I checked and I have geos_c.dll on my C:\OSGeo4W\bin directory, but either I have missed some configuration steps or the library does not work. I need Shapely to work, so I also ran pip install shapely after installing GDAL, and it apparently worked (although it could not find the C library for GEOS). In my code, I can import Shapely, but when I try to use it

Polygon Intersection with Line | Python Shapely

≯℡__Kan透↙ 提交于 2019-11-30 15:02:09
问题 I have been trying to use shapely to find the intersection of a line and a polygon, but I'm having issues with some floating point numbers. Example code: polygon = [(4.0, -2.0), (5.0, -2.0), (4.0, -3.0), (3.0, -3.0), (4.0, -2.0)] shapely_poly = shapely.geometry.Polygon(polygon) line = [(4.0, -2.0000000000000004), (2.0, -1.1102230246251565e-15)] shapely_line = shapely.geometry.LineString(line) intersection_line = list(shapely_poly.intersection(shapely_line).coords) print intersection_line What