Hot answers tagged

15 votes
Accepted

ST_Union fails with TopologyException despite valid polygons and using ST_SnapToGrid

This happens often with ST_Intersection, irrespective of whether you use ST_SnapToGrid (which is more useful for ensuring a certain precision than for fixing geometry errors) and ST_MakeValid. The ...
  • 13.4k
8 votes
Accepted

Geopandas [Shapely] spatial difference: TopologyException: no outgoing dirEdge found

It is a GEOS well-known problem (with Shapely, RGeos-RGdal example or PotGIS example and ...). It simply means there is a line crossing another line and no intermediate coordinate records the ...
  • 52.4k
7 votes
Accepted

inaccurate distance measurements in Python

If you inverse the coordinates, it does not work (geopy uses (latitude,longitude) in the WGS84 crs) dublin = (53.33306,-6.24889) liverpool = ( 53.41058,-2.97794) print distance(dublin, liverpool)....
  • 52.4k
6 votes
Accepted

Geometric Operations in GIS Systems

Possible error of your geometric operation depends on: overall size of the objects - bigger size increase errors, projection that you use, datum that you use (each datum suits some parts of the ...
  • 5,561
6 votes
Accepted

QGIS and Shapely : Shell is not a LinearRing

I finally found the solution. Qgis was using its own version of the GEOS library and Shapely its own too. So when launching my script from QGIS, shapely was trying to use QGIS's GEOS instead of his. I ...
  • 111
5 votes

Taking Union of several geometries in GEOS Python?

Python osgeo inlcudes a UnionCascaded method that implements the underlying GEOS CascadedUnion method. It is a little strange in that while Union takes two geometries (in form geom1.Union(geom2)), ...
5 votes

Load multipolygons from GeoJSON into GeoDjango model

The issue: You're trying to save a feature of type 'Polygon' to a field defined for MultiPolygons. (You'll notice a list of geojson features often have both Polygons and MultiPolygons.) I'm using ...
4 votes
Accepted

Polygon area calculation in Ruby (on Rails, rgeo, PostGIS and GEOS) in sqare meters

Yes, if you want ST_Area() on a bare geometry to return a planar area, you need to use an area-preserving CRS. GEOS is not magic, it just works in whatever units are handed to it, assuming cartesian ...
  • 19.5k
4 votes
Accepted

How to find points present in one layer but not in a second layer, using ArcGIS?

You can use Select By Location and then switch the selection by right clicking the layer that has the selection and choosing "Selection" and then "Switch Selection". The image ...
  • 4,469
4 votes

Install Shapely with GEOS on heroku

Heroku now has built-in, experimental support for a few geo-location libraries including shapely's dependency GEOS. You just need to set the following config variable from your command line: ...
  • 141
4 votes
Accepted

Shapely's simplify won't simplify any more

Read "preserve topology" as "don't let polygon rings intersect other rings." At some point (~1/15th the number of original points in your case) the algorithm can't simplify any further without ...
  • 8,718
4 votes
Accepted

PostGIS geometry to GEOS geometry without lwgeom dependency?

It is not clear to me whether you are looking specifically for information on loading point clouds, or geometries in general. GEOS may not be the ideal tool for manipulating point clouds, but you ...
  • 3,051
4 votes

GEOS geoprocessing error when using difference tool in QGIS

Not a very useful error message is it! Firstly, lets see if we can do something about that. You can check the QGIS log panel. (Right click on tool bar > Log Messages Panel) This may give you more ...
  • 2,965
3 votes

Create a new point from a reference point, degree and distance

another method I found import pyproj endLon,endLat,backAzimuth = (pyproj.Geod(ellps='WGS84') .fwd(startLon,startLat,forwardAzimuth,distance)) See http://jswhit.github.io/pyproj/pyproj.Geod-...
  • 207
3 votes
Accepted

Create a new point from a reference point, degree and distance

Why with Geos? I've used pygc (based on Spheroid) for another Python solution (excerpt below) from pygc import great_circle # New point from initial point, distance, and azimuth great_circle(...
  • 29.3k
3 votes
Accepted

Gdal+Geos point in polygon test fails under MinGW64

The build is broken. After a long debugging, I found out that if PROJ4 isn't compiled before gdal, the resulting library will NOT work correctly with different reference spaces.
3 votes

How to install everything "geo" in Ubuntu?

In my experience using Ubuntu with GIS products will not be problematic. But you should try to keep to Long Term Support (LTS) versions of Ubuntu. The reasons are among others: Cutting edge versions ...
  • 3,153
3 votes
Accepted

Parsing WKB with python geos: ParseException: Unknown WKB type 16

So, in a nutshell: this is actually a MySQL binary blob of wkt. With AsText(column) I was able to get a normal wkt format, and then parse it with shapely/geopy: d = pd.read_sql_query('''SELECT AsText(...
  • 1,754
3 votes

Convex hull with n points using computational geometry libraries

ST_ConvexHull It is often used to determine an affected area based on a set of point observations. Also worth nothing, It is usually used with MULTI and Geometry Collections. Although it is ...
  • 6,791
3 votes

Issue with GEOS not creating buffer correctly for use in Django

The offender may well be this line: poly = center.buffer(2000) Are you certain those units are in meters? I've had issues with rasters being created at 0.5 arc degrees as apposed to 0.5m. EDIT: ...
  • 148
3 votes
Accepted

GeoPandas returning incorrect spatial join results. GDAL problem? GEOS problem?

Turns out that it's not GDAL or GEOS. It was rtree. I asked the same question over here on github, and they suggested I check the version of rtree. The version on Ubuntu was 0.8.2, and the version on ...
  • 171
3 votes

Load multipolygons from GeoJSON into GeoDjango model

You are getting this error because the geometry type in the json file is of type "Polygon" and the Django geometry field is MultiPolygon. So we have to create a Polygon GEOSGeometry and ...
  • 141
3 votes
Accepted

GeoPandas overlaps sjoin fails when two geometries are identical

As @Vince said in the comments, the behavior of the function is consistent with the definition of overlap (emphasis mine): Geometries overlaps if they have more than one but not all points in common, ...
  • 1,847
2 votes

Accessing Noder functionality through C API of GEOS?

No, GEOS C API does not provide access to the Noder features. The C++ interface should not be used directly; the geos project views it as a bug for another program to use the C++ interface or ...
  • 229
2 votes

Importing geos from shapely

Shapely is not just a pure Python module, it has some "extras" (extensions written in C,C++, from the GEOS library, that need to be compiled and linked before being used, with the Cython module). ...
  • 52.4k
2 votes
Accepted

GEOS_ERROR: TopologyException: Input geom 1 is invalid: Self-intersection at or near point

If I understood your question right, what you are trying to do is an aggregate union of a Django GeoQuerySet. There are functions for this that are easier to use and probably more efficient than the ...
  • 2,963
2 votes
Accepted

Trouble getting shapely to run

You have to point your system to where the GEOS Framework is located. See this post: DYLD_LIBRARY_PATH="/Library/Frameworks/GEOS.framework/Versions/3/unix/lib" export DYLD_LIBRARY_PATH If it works, ...
  • 3,217
2 votes
Accepted

GDAL with GEOS support, pandas and VTK using python on Windows?

As one of the maintainers of the 'osgeo' conda channel (which, as noted on the project description had no affiliation with the OSGEO foundation and was only intended for internal builds of 'osgeo' ...
2 votes
Accepted

Finding neighbors for non adjacent polygons in R

Since you cannot really define contingency based on common boundaries (using something like spdep::poly2nb), you could use the polygon centroids to build a k nearest neighbor relationship. This will ...
2 votes
Accepted

Strange result with ST_Distance, geography type and equator

Let's break down your polygon, segment by segment: POLYGON((-90 -80, 90 -80, 90 10, -90 10, -90 -80)) -90 -80, 90 -80 : this segment goes straight over the south pole 90 -80, 90 10 : this segment ...
  • 19.5k

Only top scored, non community-wiki answers of a minimum length are eligible