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.
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 ...
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 ...
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 (
...
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>
;
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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" ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
postgis × 9098postgresql × 2928
qgis × 1366
sql × 528
geoserver × 525
pgrouting × 445
raster × 392
openstreetmap × 375
python × 326
polygon × 300
coordinate-system × 289
geometry × 274
shapefile × 254
postgis-2.0 × 198
intersection × 197
gdal × 191
ogr2ogr × 183
geojson × 171
linestring × 170
openlayers-2 × 168
point × 159
query × 153
distance × 141
osm2pgsql × 136
srid × 128