Skip to main content

Questions tagged [geos]

A library providing vector geometry services

Filter by
Sorted by
Tagged with
5 votes
1 answer
91 views

TopologyException: side location conflict while intersects on valid polygons

I am cheking if two valid polygons intersects using GEOS. The error is the same when I use Djangos GEOS binding or PostGIS which make me think this is a GEOS related issue. Here is the error when ...
Paul Etienney's user avatar
4 votes
1 answer
94 views

Can I edit the EWKB format to use only 4 bytes for coordinate values instead of 8 bytes in PostGIS?

I am using PostgreSQL with PostGIS to store a large amount of polygons. I want to minimize the space my polygons are taking up in my database and since all the coordinate values of the polygons I am ...
L K's user avatar
  • 49
2 votes
1 answer
71 views

Segmentation fault on ST_ConcaveHull call [closed]

I have a problem on creating a polygon for a geometry by using the ST_ConcaveHull algorithm. Following line geometry creates a segmentation fault and breaks the connection to my Java application. ...
Bora's user avatar
  • 23
4 votes
2 answers
380 views

Cryptic PostGIS/GEOS topology error

I'm attempting to determine 1) what "ring edge missing" means in the following PostGIS/GEOS error message, and 2) why ST_Intersection throws it for certain gridSize parameters but not for ...
Geolographist's user avatar
0 votes
0 answers
124 views

MySQL WKB geometry corrupted after QGIS manipulation - Unknown WKB type 535

I have a quite complex issue. I have been using MySQL (MariaDB to be specific) for storing shapely geometries. All went well until the customer wanted to slightly change the position of one point. ...
Tadeas D's user avatar
0 votes
2 answers
104 views

Find distance from point to coastline

I have a layer of ~2 million line segments representing rivers, and a layer of ~300 000 line segments representing the coastline. I want to extract the river outlets. I've tried a bunch of different ...
akvilas's user avatar
  • 103
1 vote
0 answers
54 views

PostGIS / ST_Intersection error GEOSIntersects: TopologyException [duplicate]

With PostGIS, I want to generate a new table being the result of the intersection of a table of mixed geometries and a polygonal layer. Here is my attempt. I think this request is valid. But I have an ...
user35117's user avatar
  • 929
1 vote
4 answers
2k views

Get a numpy array out of a GeoDataFrame of shapely Points in shapely >=2.0

I had the following code in shapely 1.8.5.post1 which was working but was throwing a warning: import os os.environ['USE_PYGEOS'] = '0' import numpy as np import geopandas as gpd from shapely.geometry ...
swiss_knight's user avatar
  • 10.7k
2 votes
0 answers
649 views

GEOSException: bad allocation when using pygeos geopandas buffer

I am running python 3.10 through Spyder with geopandas 0.12.0, geos 3.11.0 and pygeos 0.13. I am trying to buffer a shapefile containing lines. I have used this script on a similar dataset before and ...
Maarten 's user avatar
3 votes
0 answers
45 views

PostGIS/GEOS strange TopologyException

How can this happen mv_kuvio=> select id,st_isvalid(geom) from x; id | st_isvalid -----+------------ 376 | t (1 row) mv_kuvio=> select k.id,st_isvalid(k.geom) from kuvio k, x where ...
Ari Jolma's user avatar
  • 111
1 vote
1 answer
1k views

Using GEOS concave hull algorithm from Python

I don't want to reinvent the wheel; is there a way to use the GEOS concave hull algorithm from Python, for example from Shapely (or other Python libraries) in a 'natural' way, e.g. relatively close to ...
swiss_knight's user avatar
  • 10.7k
0 votes
1 answer
370 views

ST_ConcaveHull() is giving strange results in some specific cases

I'm playing around with ST_ConcaveHull() (baked on top of GEOS) in the hope of solving a small PostGIS problem that I have. I'll got straight to the point. This is working: SELECT ST_ConcaveHull( ...
swiss_knight's user avatar
  • 10.7k
0 votes
1 answer
40 views

Sew lines with tiny deviations due to numerical inaccuracy to construct a concave shaped polygon

Context I initially had a PostGIS problem when it comes to closing a globally V-shaped multi-line (having some local concavities) into a polygon. See here: Closing a concave V-shaped MultiLineString ...
swiss_knight's user avatar
  • 10.7k
2 votes
3 answers
272 views

Closing a concave V-shaped MultiLineString in PostGIS to form a Polygon

I have a 3D MultiLineString (roughly ~2'400 segments) in PostGIS forming kind of a V-shape (blue line on the image bellow) which I need to close (e.g. with the desired green closing straight line) in ...
swiss_knight's user avatar
  • 10.7k
0 votes
1 answer
1k views

GeoPandas overlaps sjoin fails when two geometries are identical

I am trying to find all polygons that overlap in a collection. In my unit test I added the following: import geopandas as gpd import pandas as pd from shapely.geometry import box s1 = [1, 2, 3, 4, 0....
oarsome's user avatar
  • 113
0 votes
1 answer
210 views

Clip Raster with Shapefile GDAL API

I am trying to clip a raster using a polygon an GDAL. The following code is running without an error but the ouputimage is all zeros. All files are in the same CRS. Is there a way to use GdalWarp with ...
Roots19's user avatar
1 vote
0 answers
232 views

Saving GEOS projection data into a NetCDF file

I have full disc data in GEOS projection and I would like to save this data into a NetCDF4 file. As the NetCDF file needs to have basic dimensions of lat, long and time (which can be set to 'None') ...
raghu330's user avatar
2 votes
0 answers
159 views

If GDAL is compiled against GEOS, is there a way to know on which GEOS version it relies?

Is there a(n easy) way to know the GEOS version GDAL was compiled with? I recently faced some strange errors (related to invalid geometries) both in PostGIS and rasterio and I have the feeling that ...
swiss_knight's user avatar
  • 10.7k
1 vote
1 answer
580 views

Using ST_Union to aggregate polygon parts resulting of ST_SubDivide leads to a GEOS TopologyException

Follow up on this topic: Optimizing an intersection between a single massive multipolygon (WKT) and many features from PostGIS I noticed I have to run an ANALYZE (not VACUUM ANALYZE!) on the table for ...
swiss_knight's user avatar
  • 10.7k
1 vote
0 answers
520 views

GEOS_ERROR ParseException Unknown type MULTILINESTRINGZM

i have a MULTILINESTRING layer in posgis table and I wand to add new features from export layer using some algorithm in QGIS processing and Python but the export layer from QGIS processing has type ...
hellas's user avatar
  • 393
0 votes
0 answers
1k views

How to install GDAL 2.4.4 with GEOS support in Python 3.7 on Ubuntu?

I seem unable to get GEOS support for GDAL 2.4.4 to work in Python on my Ubuntu 20.04 machine. I've done the following: Installed libgeos-dev on my system Downloaded and extracted gdal-2.4.4.tar.gz ./...
travisb's user avatar
  • 43
3 votes
0 answers
654 views

How to ignore GEOS intersection error in PostgreSQL

Basically I have a query/view which extracts data from many different layers. I would post it here but it actually has almost 2000 lines. Queries go something like select a.id (select count(*) from ...
Luffydude's user avatar
  • 2,350
8 votes
4 answers
6k views

GEOS geoprocessing error when using difference tool in QGIS

I am using QGIS version 3.14.0. I have about 20 polygon .shp-files with overlaps between files. All are in the same projection. I've been using the difference tool to remove the overlaps and then ...
Sam Coggins's user avatar
1 vote
0 answers
82 views

Polygon st_union in sf drops some polygons from output

I have written the following code that downloads state boundaries and population data from the US Census and then recursively merges the least populated states with their least populated neighbors. ...
THK's user avatar
  • 111
1 vote
2 answers
743 views

Non-noded intersection issues from overlapping buffer objects

I am working with valid lat/lon point data, creating buffers, and trying to calculate overlapping areas from buffers and running into the not-so-rare error with non-noded intersections when using ...
dshkol's user avatar
  • 141
3 votes
0 answers
12k views

Python Shapely could not find 'geos_c.dll' in Windows 10

I was trying to install and work on 'Shapely' library of python on Windows 10. Installation was successful but when I tried to import it then it gave error : OSError: Could not find lib geos_c.dll or ...
Sonu Gadewar's user avatar
0 votes
1 answer
52 views

Difference in area size calculation since update packages

On my mac I use brew to install PostGIS and all dependencies, including geos. Since month or so, I have a failing test in my Python code. A polygon that is entered in WGS84 (srid 4326), the converted ...
dyve's user avatar
  • 133
1 vote
0 answers
111 views

KNMI MSGCPP geoview to WGS84

I would like to transform KNMI MSGCPP geoview netCDF file to WGS84 netCDF file with gdal_translation and gdalwarp. I got error msg. I shared the geoview netCDF file (140 MB): https://z001.s3....
TiborSzabo's user avatar
1 vote
2 answers
2k views

Steps for installing new GDAL version for Python in Ubuntu 18.04

If I'm installing the GDAL stock version from Ubuntu 18.04 then the installed version is 2.2 and I need at least 3.0.4 to better handle Sentinel 2 data. Is there a way to update GDAL to version 3.1.0?...
George's user avatar
  • 37
3 votes
0 answers
447 views

GEOS segmentation fault when loading libc.so.6

I'm trying to run a program that uses shapely on a GCE Virtual Machine (Ubuntu 18.04). I'm getting an error on the geos.py file, here is the relevant trace I'm getting: [geos:73] - [DEBUG]: Found ...
Gwenju's user avatar
  • 31
3 votes
1 answer
1k views

How does OGR detect what GEOS version I have?

I'm attempting to solve this error: ERROR 6: GEOS 3.8 or later needed for MakeValid. The version of GDAL I am running is 3.0.4 which was downloaded as a .whl from https://www.lfd.uci.edu/~gohlke/...
Francis's user avatar
  • 957
4 votes
2 answers
433 views

Why is a vertical polygon defined by WKT PolygonZ invalid?

Can you tell me, why this PolygonZ is invalid? PolygonZ ((409662 5317369 285, 409662 5317377 285, 409662 5317377 302, 409662 5317369 302, 409662 5317369 285)) The polygon is completely vertical, but ...
Marcel Gangwisch's user avatar
3 votes
2 answers
358 views

Get location of PostGIS / GEOS topology exception

I use ST_LineMerge to combine many overlapping lines, splitting them where they branch off. A prerequisite to this process is to ST_Collect my geoms of interest, then ST_Node them to ensure all ...
Charlie Lefrak's user avatar
1 vote
0 answers
77 views

Inaccurate difference operations in GEOS

I've noticed large inaccuracies in the Django GEOS API's difference operation, see the example below. In [3]: geom1 = GEOSGeometry('{ "type": "Polygon", "coordinates": [ [ [ -19.51171875, 37....
whirish's user avatar
  • 111
2 votes
1 answer
1k views

Using Geos C++ Library to return overlap and intersects [closed]

I'm running GEOS C++ Library v 3.6 on Fedora. I have a list of geometries I loaded from a shapefile and converted to geos polygons. The shapefile is large and I may be overlaying several ones to ...
CRB's user avatar
  • 31
3 votes
1 answer
345 views

Geos projection not centered on the equator?

I'm working with QGIS and satellite view projections, in order to achieve something similar to the maps created by Richard Edes Harrison for Fortune magazine in the '40s (reference). I have a question ...
marco_ferrari's user avatar
1 vote
1 answer
771 views

Hausdorff distance (ST_HausdorffDistance) extremely slow for polygons?

I have a simple SQL statement for computing the Hausdorff distance between two polygons of the form: SELECT ST_HausdorffDistance(geom1, geom2); , which is taking a long time (for a pair of polygons ...
tinlyx's user avatar
  • 11.1k
2 votes
1 answer
541 views

ST_Polygonize/Shapely cannot polygonize when overlapping with shared node/point

I'm trying to use both polygonize_full (Shapely, python) and ST_Polygonize (postgis) to get all polygons from a set of line strings. There is one case where it fails: when there is an "overlapping ...
Kevin Redman's user avatar
4 votes
3 answers
737 views

ST_Union Topology exception despite of valid geometries

I have an isochrones layer and I want to calculate the population lays on the overlapping regions. My first step is to create an intersection between all the isochrones. After that, I try to create a ...
alasarr's user avatar
  • 461
2 votes
2 answers
8k views

Load multipolygons from GeoJSON into GeoDjango model

I have a simple model: from django.contrib.gis.db import models class CountryShapes(models.Model): geonameid = models.PositiveIntegerField(primary_key=True) geom = models.MultiPolygonField() ...
its30's user avatar
  • 567
3 votes
1 answer
2k views

Get exterior ring of a multipolygon using GEOSGeometry or PostGIS

I am trying to get the exterior ring of the multipolygon in the image below using GEOSGeometry (through GeoDjango) or Postgis, but I have not found an easy solution. This is an example of a ...
kaveh's user avatar
  • 131
0 votes
1 answer
310 views

How to call GEOS error handlers provided during initialization (initGEOS)?

From what I learned, when using GEOS in C/C++, it should be initialized first using initGEOS : extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function, GEOSMessageHandler ...
tinlyx's user avatar
  • 11.1k
2 votes
1 answer
576 views

PostGIS geometry to GEOS geometry without lwgeom dependency?

I've been looking for ways to convert PostGIS to GEOS geometries without linking to or dependency on lwgeom/liblwgeom. The closest thing I can find is a mention of the pointcloud approach here: ...
tinlyx's user avatar
  • 11.1k
0 votes
1 answer
461 views

Enabling C++ standards when compiling GEOS using cmake/ccmake?

I read from RFC # 7 of GEOS that the old autoconf based build system may be removed in the future, in favor of using cmake. I sometimes need to customize geos and add functions that uses the newest C+...
tinlyx's user avatar
  • 11.1k
2 votes
0 answers
574 views

Why is Union in ArcMap much faster than other approaches? [closed]

Taking the union* of these two large shapefiles file1 file2 locally using ArcMap takes appr. 10 min. Over the last few weeks, I've tried to obtain the same results using other, open-source ...
RutgerH's user avatar
  • 3,345
2 votes
1 answer
413 views

Update R-tree to insert after query

I would like to use the GEOS R-tree implementation to store the items of a growing structure. However, I also need to query from the tree during the growth process to make sure that growing ...
Silmathoron's user avatar
0 votes
0 answers
883 views

Can't upgrade PostGIS on Ubuntu with Postgres 10?

I am running Postgres 10.5 (I think) on Ubuntu 14.04. I want to upgrade to PostGIS 2.2+ so I can use ST_Subdivide. I've done: apt install postgresql-10-postgis-2.4 But when I try to upgrade PostGIS ...
Richard's user avatar
  • 3,309
6 votes
1 answer
257 views

ST_3DIntersects says 'no' despite geometries intersecting

Considering the following query I expect both geomb and geomc to 3D Intersect with geoma. According to postgis, only geomc intersects. Unfortunately I can't come up with a more simplified polygon as ...
tilt's user avatar
  • 3,279
2 votes
2 answers
5k views

Error building GEOS on Ubuntu 18.04

Following the directions to install geodjango on linux ubuntu 18.04, so far here are my commands: sudo apt-get install binutils libproj-dev gdal-bin wget http://download.osgeo.org/geos/geos-3.4.2....
ziggy's user avatar
  • 4,546
1 vote
1 answer
96 views

What is IndexedFacetDistance in JTS?

I just read from GEOS 3.7 documentation that there is a new IndexedFacetDistance imported from JTS. Reading from the JTS link, I cannot tell what the new distance metric does except that it's taking ...
tinlyx's user avatar
  • 11.1k