geos

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

activerecord_postgis_adapter: undefined method `point' for nil:NilClass

半腔热情 提交于 2019-11-30 19:55:43
问题 Problem 90% sure it's a setup error on my end, but I can't do self.factory and trying to access lonlat gives me an exception "undefined method `point' for nil:NilClass" I can Set lonlat using: mfactory = RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(:geo_type => 'point') self.lonlat = mfactory.point(long, lat) self.save This gives me values like 0101000020E610000061C3D32B65965DC03657CD7344F64040 in the db. I can't use: self.lonlat = "POINT(#{long},#{lat})" self.save Questions Do I

GeoDjango: How to create a circle based on point and radius

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 02:41:48
I have the following (simplified) Model: class Zone(gismodels.Model): name = gismodels.CharField() poly = gismodels.PolygonField() I want to create and save a polygon that represents a circle, based upon a given point and radius. The only way I can figure out how to achieve this, is to call the postgis ST_Buffer function using raw SQL. I'm really hoping that there is another way. Is it possible to access the GEOS buffer methods? Yes, it is possible to use the geos buffer method : >>> from django.contrib.gis import geos >>> center = geos.Point(5, 5) >>> radius = 2 >>> circle = center.buffer

OSError geos_c could not be found when Installing Shapely

冷暖自知 提交于 2019-11-29 09:13:14
I'm a newbie to making/plotting on maps with python, been trying to follow this blogpost to generate a world map (http://sciblogs.co.nz/seeing-data/2011/08/12/plotting-geographic-data-on-a-world-map-with-python/). Got stuck with a few things here: Installing Basemap (a Matplotlib extension for plotting data on geographic projections). from mpl_toolkits.basemap import Basemap Traceback (most recent call last): File "geos_demo.py", line 1, in <module> from mpl_toolkits.basemap import Basemap ImportError: No module named mpl_toolkits.basemap Install Shapely, but the following error occurs [1]:

OSError geos_c could not be found when Installing Shapely

こ雲淡風輕ζ 提交于 2019-11-28 02:37:59
问题 I'm a newbie to making/plotting on maps with python, been trying to follow this blogpost to generate a world map (http://sciblogs.co.nz/seeing-data/2011/08/12/plotting-geographic-data-on-a-world-map-with-python/). Got stuck with a few things here: Installing Basemap (a Matplotlib extension for plotting data on geographic projections). from mpl_toolkits.basemap import Basemap Traceback (most recent call last): File "geos_demo.py", line 1, in <module> from mpl_toolkits.basemap import Basemap

Coordinates of the closest points of two geometries in Shapely

落花浮王杯 提交于 2019-11-27 20:06:01
There is a polyline with a list of coordinates of the vertices = [(x1,y1), (x2,y2), (x3,y3),...] and a point(x,y). In Shapely, geometry1.distance(geometry2) returns the shortest distance between the two geometries. >>> from shapely.geometry import LineString, Point >>> line = LineString([(0, 0), (5, 7), (12, 6)]) # geometry2 >>> list(line.coords) [(0.0, 0.0), (5.0, 7.0), (12.0, 6.0)] >>> p = Point(4,8) # geometry1 >>> list(p.coords) [(4.0, 8.0)] >>> p.distance(line) 1.4142135623730951 But I also need to find the coordinate of the point on the line that is closest to the point(x,y). In the

Coordinates of the closest points of two geometries in Shapely

限于喜欢 提交于 2019-11-26 22:50:24
问题 There is a polyline with a list of coordinates of the vertices = [(x1,y1), (x2,y2), (x3,y3),...] and a point(x,y). In Shapely, geometry1.distance(geometry2) returns the shortest distance between the two geometries. >>> from shapely.geometry import LineString, Point >>> line = LineString([(0, 0), (5, 7), (12, 6)]) # geometry2 >>> list(line.coords) [(0.0, 0.0), (5.0, 7.0), (12.0, 6.0)] >>> p = Point(4,8) # geometry1 >>> list(p.coords) [(4.0, 8.0)] >>> p.distance(line) 1.4142135623730951 But I