Hot answers tagged

7 votes
Accepted

How to get minimum bounding box for a set of polygons using Postgis

A bounding box is usually defined to be aligned to the axes of the coordinate system. That is what ST_Envelope creates. To get the geometry you drew, you can use ST_OrientedEnvelope instead.
bugmenot123's user avatar
  • 10.3k
6 votes
Accepted

Algorithms for finding nearest road

You can use Hausdorff distance: Two sets are close in the Hausdorff distance if every point of either set is close to some point of the other set. Here I cross join the table to itself to compare ...
BERA's user avatar
  • 63.6k
6 votes
Accepted

Getting the vertices of UTM grid in PostGIS

To extract the contextual corner points of each cell, find those vertices that have an angle greater than roughly 90° with respect to the preceding and following vertex: SELECT utm_c.[*], -- list ...
geozelot's user avatar
  • 27.9k
4 votes
Accepted

Removing duplicates geometry rows in PostGIS

TL;DR: Depends¹. A flexible and generally better performing approach for both cases would be to use an EXISTS expression: SELECT: SELECT t.* FROM <mytable> AS t WHERE NOT EXISTS ( ...
geozelot's user avatar
  • 27.9k
4 votes
Accepted

Checking all existing SRIDs in a PostGIS database

That's exactly what the public.geometry_columns & public.geography_columns Views are for: SELECT * FROM public.geometry_columns -- WHERE -- srid = <srid> ;
geozelot's user avatar
  • 27.9k
3 votes
Accepted

Break medial axis into a set of simple polylines using PostGIS

Decomposing MULTILINESTRINGS into simple LINESTRINGs - or any MULTI geometry or GEOMETRYCOLLECTION into their simple parts and components - is trivial with ST_Dump: using (CROSS JOIN) LATERAL set ...
geozelot's user avatar
  • 27.9k
3 votes
Accepted

PostGIS, creating spatial index on box2d column failes

As the error message says you can't build a gist index on a box2d. You can make them into polygons and use a gist index or look at different index types but I suspect that those won't really speed ...
Ian Turton's user avatar
  • 79k
2 votes
Accepted

What is the difference between pg_tileserv and Martin?

pg_tileserve is a Go-based tile server that focuses on generating tiles from a single Postgres database server. Martin is a Rust-based tile server that supports multiple simultaneous Postgres ...
Yuri Astrakhan's user avatar
2 votes

WFS in PostGIS OGR FDW results in "ERROR 1: No schema information loaded."

The error messages comes from GDAL/OGR's NAS driver and means that it could not find a (GFS) schema that describes the data. In my case I did not want the data to be loaded using NAS but as standard ...
bugmenot123's user avatar
  • 10.3k
1 vote

Trouble calculating area consistently

This answer might help you Just to be clear it is difficult to get the exact same result when calculating areas with methods from different toolboxes. They might use different constants and/or as you ...
Martin Wangen-Eriksen's user avatar
1 vote

Match rows from different tables by comparing similar lat lon coordinates

A plain proximity search (e.g. via ST_DWithin) comes with the drawback that it finds all geometries within the given distance threshold - this may work out in cases where the threshold is in ...
geozelot's user avatar
  • 27.9k
1 vote
Accepted

raster2pgsql excessive memory usage

This was solved by running "raster2pgsql | pqsl" in a cmd terminal and not powershell. https://www.postgresql.org/docs/current/app-psql.html Refer to the "Notes for Windows Users" ...
Francis's user avatar
  • 877
1 vote

Creating Linestring from GPX file with M coordinate as time

Once you have the data in Postgres/Postgis, you can use st_makeline and st_makepointm. You can run this query in the terminal after you connect to your database, or use pgadmin. create table ...
jbalk's user avatar
  • 6,900
1 vote

How can I convert PostGIS geography to geometry and split polygons that cross the antimeridian

Pete's answer was helpful, although I was getting an error like, aggregate function calls cannot contain set-returning function calls. Nevertheless, I got it working using that strategy then took it a ...
elrobis's user avatar
  • 6,380
1 vote

Storing custom field for each Polygon within a MultiPolygon in a single PostGIS table

You could model this relationally with a table for the Polygons with Soil attributes, and link to a parent table containing the play area attributes. The required MultiPolygons could be provided in a ...
dr_jts's user avatar
  • 4,451
1 vote

PostGIS: ST_LineMerge can make LineString from MultiLineString

We can see on the shape drawing that the lines are disconnected, so you won't be able to convert it to a single simple linestring. You can however convert each part of the multiline to a single line ...
JGH's user avatar
  • 38.3k
1 vote

Kosmtik: PostGIS Plugin: FATAL: Peer authentication failed for user

Postgis is trying to use peer authentication but failing, so I suspect that you are not logged in as user _rendered so when postgis checks with the system it rejects the login. As you didn't specify ...
Ian Turton's user avatar
  • 79k

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