r/postgis • • Sep 23 '24

What's with the coordinates being moved hundreds of miles northwest when converted to GeoJSON?

0 Upvotes

For lat/lng 31.06075, -94.106025, I am adding these to the DB using the following:

ST_Transform(ST_SetSRID(ST_MakePoint(lng, lat), 4326),3857)

This returns 0101000020110F00006C14135927FB63C12D21FC99A0C64B41 as the geometry. When I pass that to ST_AsGeoJSON, it returns

{"type":"Point","crs":{"type":"name","properties":{"name":"EPSG:3857"}},"coordinates":[-10475834.783579074,3640641.203006884]}

The original coordinates are somewhere in Texas, near Lake Sam Rayburn. When I divide the coordinates above by 100000 (and reverse their order), I get coordinates that are somewhere in Arizona.

We're using MapServer to get a WMS map and it renders the location correctly. However, when I request GeoJSON, I get the above GeoJSON. Why are the coordinates changed like that, other than their order?


r/postgis • • Apr 30 '24

Rocky 9 pgdg gdal upgrade issues

0 Upvotes

Since I can't post images here, for whatever reason, here's the text version.

This has been going on for more than 4 months. Idk where else to report it, that doesn't require a torture of account creation and subscribing to some mailing list (I hate mailing lists, they spam the shit out my mailbox) or some obscure ticketing system.

# dnf update
Last metadata expiration check: 2:44:52 ago on Tue 30 Apr 2024 07:58:49 AM CEST.
Error: 
 Problem 1: cannot install the best update candidate for package gdal36-libs-3.6.4-5PGDG.rhel9.x86_64
  - nothing provides libarmadillo.so.12()(64bit) needed by gdal36-libs-3.6.4-6PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmlbase.so.1()(64bit) needed by gdal36-libs-3.6.4-6PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmldom.so.1()(64bit) needed by gdal36-libs-3.6.4-6PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmlengine.so.1()(64bit) needed by gdal36-libs-3.6.4-6PGDG.rhel9.x86_64 from pgdg-common
 Problem 2: package postgis34_16-3.4.2-3PGDG.rhel9.x86_64 from pgdg16 requires libgdal.so.34()(64bit), but none of the providers can be installed
  - package postgis34_16-3.4.2-3PGDG.rhel9.x86_64 from pgdg16 requires gdal38-libs >= 3.8.4, but none of the providers can be installed
  - cannot install the best update candidate for package postgis34_16-3.4.2-1PGDG.rhel9.x86_64
  - nothing provides libarmadillo.so.12()(64bit) needed by gdal38-libs-3.8.5-1PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmlbase.so.1()(64bit) needed by gdal38-libs-3.8.5-1PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmldom.so.1()(64bit) needed by gdal38-libs-3.8.5-1PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmlengine.so.1()(64bit) needed by gdal38-libs-3.8.5-1PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libarrow.so.900()(64bit) needed by gdal38-libs-3.8.5-1PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libdeflate.so.0()(64bit) needed by gdal38-libs-3.8.5-1PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libarmadillo.so.12()(64bit) needed by gdal38-libs-3.8.5-3PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmlbase.so.1()(64bit) needed by gdal38-libs-3.8.5-3PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmldom.so.1()(64bit) needed by gdal38-libs-3.8.5-3PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libkmlengine.so.1()(64bit) needed by gdal38-libs-3.8.5-3PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libarrow.so.900()(64bit) needed by gdal38-libs-3.8.5-3PGDG.rhel9.x86_64 from pgdg-common
  - nothing provides libdeflate.so.0()(64bit) needed by gdal38-libs-3.8.5-3PGDG.rhel9.x86_64 from pgdg-common
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

r/postgis • • Dec 20 '23

Can't use PostGIS on Windows 10

0 Upvotes

Hey guys, I posted my issue on this reddit. Any tips?


r/postgis • • Aug 30 '25

Load workflow & orchestration

1 Upvotes

New to GIS data sources. Seems like there is a wide variety of routes involved in obtaining data !

  • live links / manual download

  • connection type (WFS, OGC)

  • service protocols (HTTP, OGC)

  • data format (gpkg, shp, CSV)

  • encoding (gml)

I'm trying to figure out how to

  • define each declaratively

  • orchestrate ELT execution from a single entry point'

So far it's looking like a fair amount of work to write config templates, execution scripts (bash, python, SQL) and then maybe wrap them all up with a python based workflow?

Yet thinking that this must be a need for almost everyone and therefore tools/processes/best practice has already been invented.

Appreciate any experienced feedback on how this typically gets handled.

Context: Currently working locally on Windows. Assume I'll progress to a cloud base one day when suitable.

Many Thanks


r/postgis • • Oct 12 '21

Create table?

1 Upvotes

Hi, I'm a complete noob to SQL and Postgis. But I need to create points along line at defined distance (using Postgis). I've found this method:

https://gis.stackexchange.com/questions/107277/getting-points-along-line-at-defined-distance-using-postgis

But since I'm noob, I cannot write the code to actually create a point table/layer from it and use my line. Can some of you meyby help me with it? Thank you very much.


r/postgis • • Mar 19 '26

Postgis and ArcGIS

2 Upvotes

Hi, I'm trying to connect a PostgreSQL 17.13 database with PostGIS 3.5 to ArcGIS basic license, and they connect but the layers don't appear.


r/postgis • • Oct 15 '19

PostGIS 3.0 not possible to install on RHEL 8 / CentOS 8?

3 Upvotes

I am attempting to install the latest PostGIS 3.0.x on CentOS 8, with no luck.

I don't think anyone is running PostGIS on RHEL 8 or CentOS 8, I can't understand why not. It does not seem possible to install.

I have successfully installed Postgres 12.0 by disabling the RHEL AppStream

Steps I took installing postgres 12 on CentOS 8

1. 
#dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

2.  
#dnf --disablerepo AppStream install postgresql12
#dnf --disablerepo AppStream install postgresql12-server

I am attempting now to install PostGIS.

dnf list --available | grep postgis30

I see that postgis30_96 is the latest offered (as listed below)

postgis30_96.x86_64                                  3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-client.x86_64                           3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-client-debuginfo.x86_64                 3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-debuginfo.x86_64                        3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-devel.x86_64                            3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-docs.x86_64                             3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-gui.x86_64                              3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-gui-debuginfo.x86_64                    3.0.0alpha4-6.rhel8                                     pgdg96               
postgis30_96-utils.x86_64                            3.0.0alpha4-6.rhel8                                     pgdg96  

When I try to install with the following command:

#dnf install postgis30_96

I get these errors:

Last metadata expiration check: 1:22:58 ago on Tue 15 Oct 2019 08:25:10 PM UTC.
Error: 
 Problem: cannot install the best candidate for the job
  - nothing provides hdf5 needed by postgis30_96-3.0.0alpha4-6.rhel8.x86_64
  - nothing provides xerces-c needed by postgis30_96-3.0.0alpha4-6.rhel8.x86_64
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

I look for xerces-c, and nothing is returned:

dnf list --available | grep xerces-c

I look to see if hdf5 is available to install (dependency)

dnf list --available | grep hdf5

and nothing is returned. How do I satisfy these dependencies, so that PostGIS will install?

I goto the hdf5 website, download the source and it's a BIG FAT MESS. The build/install instructions do not work - the code is out of sync with the install instructions.

I check the hdf5 website and find another set of build/install instructions, and they too are out of sync with the latest code base. I don't know which way is up with this project, if it's a zombie project out there on the web, seemingly alive, but nobody's home.

How do I get hdf5 easily onto my system and xerces-c so that nothing existing gets mucked up? I would prefer to install these through any somewhat sanctioned CentOS 8 package repo using dnf.

---

I can't log this issue on the PostGIS ticket tracking system. Logging a ticket there requires an OSGEO ID, and when I request a 'mantra' to get started, nothing is returned, no response, yet another zombie project, nobody's home. https://www.osgeo.org/community/getting-started-osgeo/osgeo_userid/

---

Please respond only if you have actually done this yourself on a CentOS 8 machine or VM, while I appreciate suggestions, pointers or imaginations from others, it pollutes r/postgis reddit with misinformation, non-working solutions, and not only wastes my time with dead ends, but also the time of others.

Someone else inevitably comes along with the same problems and is misguided with these those that are well-intentioned, but provide incorrect or incomplete information.


r/postgis • • Feb 07 '25

Cloud Rasters (GeoTIFF,COG) for use in PostGIS without download

4 Upvotes

With the postgis_raster extension, it is possible to access gigabytes of raster data from the cloud, without ever downloading the data.

How? The venerable postgis_raster extension (released 13 years ago) already has the critical core support built-in!

Rasters can be stored inside the database, or outside the database, on a local file system or anywhere it can be accessed by the underlying GDAL raster support library. The storage options include S3, Azure, Google, Alibaba, and any HTTP server that supports RANGE requests.

As long as the rasters are in the cloud optimized GeoTIFF (aka "COG") format, the network access to the data will be optimized and provide access performance limited mostly by the speed of connection between your database server and the cloud storage.

More at https://www.crunchydata.com/blog/using-cloud-rasters-with-postgis


r/postgis • • Aug 09 '24

Use PostGIS with Felt to make maps, apps, and dashboards in seconds - and easily collaborate on & share the same. Check out our blog post on how to integrate the two here!

8 Upvotes

The blogpost:

https://felt.com/blog/felt-postgis-integration-gis-database-spatial-analysis-and-visualization

Sign up for our free upcoming webinar on “How to Build a Modern GIS Stack with Postgres and Felt”, hosted on Zoom on August 14th, here:

https://us06web.zoom.us/webinar/register/WN_YjSzHsLTT2KAkRCMzm32Vw#/registration 

Message us anytime here in the comments, via DM, or on https://felt.com/ if you have any questions or just want to chat! 💬


r/postgis • • Jul 31 '25

Point outside of projection domain (2050)

2 Upvotes

Since we've upgraded to postgres 17 we receive this error now, when trying to reproject from one srid to the other. Obviously I recognize that when some geometries are outside of the extent, that's not a good thing, and it seems like a reasonable error.

What I don't understand is why this error does not already appear when you're inserting the record into a table with a specific SRID or when trying to read the geometry. It's a bit annoying to have to find records that break some reprojection instead of blocking the insert of the bad data.

Alternatively is there a simple way to make a validation of the extent? Especially when working with different srids, it does not seem to be so trivial to get the boundaries from the srid definition.


r/postgis • • Mar 31 '25

Unexpected ST_Intersect() behavior between small scale Geography & Geometry objects

2 Upvotes

In this post I'll outline some odd behavior I've found when checking shapes for overlap, I.E. st_intersect(shape_a, shape_b). And how the result of st_intersects changes whether the shapes are geography or geometry objects. We're all well aware of the differences between spheroid and cartesian based intersects at a large scale, but as you can see in the image below, we're dealing with shapes that are less than 200m long in either direction where cartesian vs. spheroid shouldn't matter. In the end I'll propose two hypothesis for why I'm experiencing this odd behavior, please let me know which one you think it is, or if you think the root-cause is something else.

The setup:

  • We're dealing with two shapes < 200m in either direction

  • They're both stored as Geography objects on my postgis database

  • I've connected QGIS to said postgis database for visualization

  • Geography SRID is 4326

Zoomed in:

The shape's in WKB:

--Shape 1:

0x010300000001000000130000006C074E7606F059C067661B7A32174040461EE69DF3EF59C035FA024C321740405E955ADBF3EF59C00D0D94FC0D1740404C5BB79C06F059C07B5C39960E1740402A87D66206F059C08A007F0D131740403270AB6106F059C08A59960D13174040FACB175F06F059C062E07E0E131740408D44C95C06F059C0EB8CBB10131740409CC1F55A06F059C0C6181814131740402EF0C75906F059C06DF64518131740405A5D5B5906F059C0F67CE31C13174040915BCB3E06F059C09862FAA9241740406FB02F3F06F059C08C27BDAE24174040F95F614006F059C01C300EB324174040D9E0424206F059C0C5B582B6241740400CACA54406F059C07540C5B824174040E7BC4E4706F059C028E99DB924174040356DB14706F059C0C18EA1B9241740406C074E7606F059C067661B7A32174040

-- Shape 2:
0x01030000000100000008000000EAF76C3911F059C0A27BAE11251740408E51305006F059C0D46676AA2417404024E32E5006F059C0B53E0AAA241740405A90BD6A06F059C08639D41D13174040BF81D06A06F059C09A0E5E1C13174040815BDA1D10F059C01F58895A121740401369A1B811F059C0169F906717174040EAF76C3911F059C0A27BAE1125174040

The Problem:

  • st_intersects(shape1, shape2) -> true

  • st_intersects(shape1::geometry, shape2::geometry) -> false

  • visual inspection from qgis on intersection -> false

What gives? Why is st_intersects on our geography based shapes giving us a false positive?

Hypothesis 1:

If we take a closer look at the edge of these shapes we see that they have a bit more complexity than we can see from the first two screenshots. There's a couple vertices forming a curve. Are these tightly packed vertices throwing st_intersects() for a loop when it's running in geography mode?

Hypothesis 2:

After taking a closer look at the shapes and seeing this curve, plus thinking about how these shapes were produced (programmatic "slicing" of a single shape that got split in two), I started to question if what I'm seeing is different than the shapes definition on database. I.E. There "ghost vertices" on the source geography that are causing the geography based intersect to yield true. Then these ghost vertices are lost in the conversion to geometry and we get a result that agrees with our eyes. And QGIS is visualizing the geometry version of the shapes which is why we're not seeing the "ghost vertices" that exist on the source geography.

Another clue supporting hypothesis 2:

  • st_distance(shape1, shape2) = 0

  • st_distance(shape1::geometry, shape2::geometry) = .0000025998

Shape1 and shape2 clearly aren't touching, and I've had accurate distance measurements come from geography based shapes down to the centimeter many times before, I don't think it's a rounding error. I wouldn't be surprised if there's vertices on these source geographies that aren't be visualized by our presentation platform.

Conclusion:

I'm leaning towards hypothesis 2 but haven't found the smoking gun proving there are "ghost vertices" on my source geographies. Curious what y'all think.

I shared the WKB representation of these two shapes in the hopes it'd be easy for others to recreate on their systems and dig in further. If you're able to prove the existence (or non-existence) of these ghost vertices, I'd love to see your method. Also, if you replicate the setup and find a different explanation, please share.

Regards.


r/postgis • • Jun 15 '23

Using outdb rasters in postgis and postgresql

2 Upvotes

How do I set postgis.enable_outdb_rasters to True when I am using an aws rds instance for my database? I don't have the permission to set it on a connection level, and it also isn't an option in the parameter groups for AWS databases. If someone has any insights please share!


r/postgis • • May 27 '26

Built a library that syncs PostGIS to the browser in real time — spatial queries run locally in WASM

Thumbnail reddit.com
2 Upvotes

r/postgis • • Oct 30 '25

gdalXXX.dll missing from \bin\ folder after install postgreSQL

3 Upvotes

Hello,

I installed postgreSQL 16, 17 and 18 version thinking that the most recent version could have a problem with windows and that was the reason why the files gdal305.dll, gdal306.dll or gdal307.dll was missing but after try with precedent versions 15, 16 and 17 the files are still mising.

i read in a forum that installing pstgre directly in c:\postgreSQL worked for some people, not for me.

any idea why thoes files are not present or are hidden or they are written in a different location?

thank you


r/postgis • • Jul 23 '26

GeoPostcodes is hiring: Geospatial Data Specialist (Brussels, Belgium)

Thumbnail reddit.com
1 Upvotes

r/postgis • • Sep 02 '25

Geom Area Vs Literal Area ?

2 Upvotes

Some of my sourced datasets come with both geom & area values. As expected, st_area(geom) does not always tally 100% with the literal area value. So in such cases, which do you run with?

Obviously yes I flag these, and yes I can go back to the supplier and report discrepancies... but in the mean time I have options..

  • ditch the record entirely

  • take st_area

  • take the literal

  • average of both

  • manually investigate & clean (like I have life to waste 🤣)

Appreciate any wise inputs 🤞


r/postgis • • Aug 24 '24

Tool that accounts for one-ways, bridges, and tunnels

2 Upvotes

Hello. I've just started with postgis and actually couldn't find any information on tools that take into account one-ways, bridges, tunnels and overpasses. I have tried pgr_createtopology but it fails because my route goes onto oncoming traffic, and drives off the bridge where it's not supposed to. I have also tried osm2po, it seem to detect bridges or layers,but still drives off from an oncoming traffic ramp even though I build the route using directed graph. It seems that osm2po doesn't take into account one-way tag and doesn't assign correct cost and reverse cost, I may be wrong. I'm looking to take any advice or tool recommendations that will help with accurate route building that considers mentioned factors. Thank you in advance.


r/postgis • • Feb 24 '25

Errors during upgrade

3 Upvotes

Hi. I have spent some time making my tests pass after upgrading an old installation (postgis 2.5) to a new version.

Some of the errors was wrong use of ST_DFullyWithin, but this has been sorted out.

My remaining issue:

the query works fine as long as I dont have an index :

SELECT street,zip
FROM street
WHERE ST_DFullyWithin(
    ST_SetSRID(ST_GeomFromText('POINT(xxx yyyy)'), 32633),
    extent,
    750
) order by 1;

-- returns 9 rows
create index ON street using gist (extent );
-- query returns zero rows

I have tested on pg12,13 and 17 - for instance the docker image postgis/postgis:17-3.5

still works on pg11, postgis 2.5 :)

What am i doing wrong here?

Thank you :)

edit

steps to Reproduce:

create temp table test (street text, extent geometry(Polygon,32633));

insert into test values ('Karl Johans gate','0103000020797F0000010000000500000084377D37F9EA0F41BFDC9108495D594184377D37F9EA0F41895979F9F55D5941B3309FDC0D041041895979F9F55D5941B3309FDC0D041041BFDC9108495D594184377D37F9EA0F41BFDC9108495D5941');

set enable_seqscan=false;
SELECT street
FROM test
WHERE ST_DFullyWithin(
    ST_SetSRID(ST_GeomFromText('POINT(261471 6649815)'), 32633),
    extent,
    1700
);

-- we get our row
-- Karl Johans gate

-- create index
create index ON test using gist (extent );

-- query again

SELECT street                             
FROM test
WHERE ST_DFullyWithin(
    ST_SetSRID(ST_GeomFromText('POINT(261471 6649815)'), 32633),
    extent,
    1700
);

--  street 
-- --------
-- (0 rows)

Edit 2

This is a change in behaviour between postgis 3.4 and postgis 3.5


r/postgis • • Feb 22 '25

Conservation Tech Startups in 2025?

2 Upvotes

I love gis/geospatial type stuff….but it all feels so behind compared to the rest of tech.


r/postgis • • Aug 06 '14

Importing Large Spatial Datasets into PostGIS

Thumbnail
doublebyteblog.wordpress.com
2 Upvotes

r/postgis • • Jun 08 '11

PostGIS 1.5 Cheat Sheet

Thumbnail bostongis.com
1 Upvotes

r/postgis • • Jun 15 '11

OpenGeo Workshop: Introduction to PostGIS

Thumbnail workshops.opengeo.org
1 Upvotes

r/postgis • • Jan 28 '20

PSA: Postgresql 12 slower than 11?...

3 Upvotes

I noticed that upgrading Postgres 11 to 12 resulted in my map tile renderer being approx 50% slower for a 100km square. Logging queries over 100ms and running them by hand via psql prefixing with "explain analyze" revealed the default settings for the new JIT compilation stuff was handling some transactions and taking a long time about it: 2.5seconds vs less than 200ms. Disabled JIT, and speed restored.

I have not looked at tuning individual JIT settings.


r/postgis • • Mar 30 '22

Restarts with Postgis 2.5.1 running on Azure Postgres 11

2 Upvotes

We did a database migration on Microsoft Azure managed single server from v9.6 to v11 after we received an email from Microsoft telling us to do so since 9.6 support is going to be end of life. About 3 weeks after the migration the database server began to restart itself every 2-3 days.

We are not sure what caused this to happen after running without issues for 3 weeks. We are quite sure that it has nothing to do with our data, since our product running on GCP for another customer with mostly the same data doesn't have any issues.

Versions:

  • PostgreSQL 11.12, compiled by Visual C++ build 1800, 64-bit

  • POSTGIS="2.5.1 r17027" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0 3.7.1" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released 2018/03/19 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="0.12" LIBPROTOBUF="1.2.1" RASTER

We believe that the PostGIS plugin version is outdated. Microsoft told us first that we need to get a larger server (more CPU/Ram). After this didn't help they are trying to make us switch to their new flexible server product "which runs on Linux". This would require an effort of about one person month on our side, since we need to develop all the automated provisioning on our side (Git/Dec-Ops).

Any help would be appreciated.