Skip to main content
16 votes
Accepted

Creating custom Coordinate System in PostGIS

It's easy here Look it up on http://www.spatialreference.org Find it SR-ORG:7069 NAD_1983_HARN_StatePlane_Michigan_South_FIPS_2113_IntlFeet Click PostGIS spatial_ref_sys INSERT statement Run that ...
Evan Carroll's user avatar
  • 7,081
14 votes
Accepted

Is SRID 4326 Lon/Lat or Lat/Lon?

In principle, it should always be lat/lon as that is what the current EPSG database defines it as. Unfortunately, over the years computer scientists have visited and made a decision to use lon/lat as ...
Ian Turton's user avatar
  • 81.8k
12 votes
Accepted

Where do SRID numbers come from?

They're mostly from the EPSG - https://www.epsg-registry.org/ To be unique, you have to specify where they are from (basically a namespace - EPSG:4326, not just 4326). However most people will ...
BradHards's user avatar
  • 12.9k
12 votes
Accepted

Calling ST_Transform in geometry that is already in target srid?

The function checks for same in and out srid, and returns untouched if so, as the source code shows: /* * If input SRID and output SRID are equal, return geometry * without transform it */ if ( ...
Nicklas Avén's user avatar
10 votes
Accepted

SRID and Name relationship

If you want/need to have more info from within PostGIS, running something like SELECT srid, left(split_part(srtext, '"', 1), -1) AS "type", split_part(srtext, '"', 2) AS "name", ...
geozelot's user avatar
  • 30.3k
8 votes
Accepted

Get different SRIDs of geometry column in a table

If column in your table has explicitly defined geometry type and srid, like: CREATE TABLE geom_table (id serial, geom geometry(point,3857); Your database will not allow to place there any other ...
Jendrusk's user avatar
  • 2,617
8 votes

SRID and Name relationship

A good modern web resource is epsg.io It's "modern" because it has been synchronized to recent versions of the EPSG reference database, as stated at the bottom of the web page. It's source is ...
Mike T's user avatar
  • 42.1k
8 votes
Accepted

What exacly ST_SetSRID in PostGIS does?

ST_SetSRID will set the coordinate reference system of your geometry. This will allow PostGIS commands to understand how your grid will relate to other geometries. Using ST_SetSRID is not essential, ...
ProudGIS's user avatar
  • 763
8 votes
Accepted

Reprojecting in PostGIS not working as expected

UpdateGeometrySRID only ever sets the SRID identifier (and changes the typemod accoridngly), it does not reproject! This scenario is covered by the docs: If you got the projection wrong (or brought ...
geozelot's user avatar
  • 30.3k
7 votes
Accepted

What SRID is this?

There could be two possibilities. If the coordinates are in km and is the top of a ridgeline/mountain (approximately lat:46.853795 lon:7.985557), the CRS could be CH1903 / LV03, EPSG::21781. If the ...
mkennedy's user avatar
  • 18.9k
7 votes

What exacly ST_SetSRID in PostGIS does?

With ST_SetSRID it is possible to define explicitly what the coordinates like (-122.079513,45.607703) mean: for example that they are WGS84 long-lat degrees https://epsg.io/4326 and not something ...
user30184's user avatar
  • 66.3k
6 votes
Accepted

Length of reversed geometry in meters

Yes, this is a rounding error, a slight difference in the result depending on order of operands. Not sure what ST_LengthSpheroid() differs, but it's possible there's a slightly different code path ...
Paul Ramsey's user avatar
  • 19.9k
6 votes
Accepted

Distance from point stored in geometry with SRID 4326

You want to use ST_DWithin() which takes advantage of indexing SELECT * FROM adresse WHERE ST_DWithin(latlong::geography, ST_SetSRID(ST_Point(16.520, 47.846), 4326)::geography, 200) ORDER BY ...
kttii's user avatar
  • 3,630
6 votes
Accepted

Problems with SRID 32717

epsg:32717 is a UTM projection in meters, not degrees, which covers a thin strip from Ecuador down through Peru. You're telling it the point coordinates you have are in epsg:32717. But these seem to ...
Steven Kay's user avatar
  • 20.4k
6 votes

What SRID is this?

I've found a couple of useful tools to find possible CRSes if you know the general area. epsg.io : this is a web site which is a search engine for CRSes. Type in something like 'Switzerland' and it'...
Steven Kay's user avatar
  • 20.4k
6 votes
Accepted

Getting geometry column integer SRID from a GeoPandas geodataframe?

In geopandas <= v0.6.3., gdf.crs returns a dictionary like {'init': 'epsg:EPSG_CODE'}. So, more appropriate way is to use tools of geopandas defined in geopandas.tools module. geom_srid_num = gpd....
Kadir Şahbaz's user avatar
6 votes

How to overlay layers with different SRID using QGIS and PostGIS?

This is one of the most infamous issues in the GIS world: setting vs. transforming a CRS. Take your time and get familiar with coordinate references, projections and transformations - it will make ...
geozelot's user avatar
  • 30.3k
6 votes

If my geometry is stored in 4326 / WGS 1984 what should I transform to for the most accurate area in sq m?

Cast to geography and use use ST_Area to calculate area with units m². SELECT ST_Area('MULTIPOLYGON (((-98.12317899283 26.29444331481, -98.12355263136 26.29220720658, -98.1274736313 26.29279476234, ...
Mike T's user avatar
  • 42.1k
5 votes
Accepted

Updating the Entry in geometry_columns for Spatial Table Created from a Query

With PostGIS 2.x, geometry_columns is a VIEW, not a TABLE. Try altering my_table.geom to your specifications using: ALTER TABLE my_table ALTER COLUMN geom TYPE geometry(LineString, 4326) USING ...
Mike T's user avatar
  • 42.1k
5 votes
Accepted

What is the SRID for this .prj file?

NAD 1983 StatePlane South Carolina FIPS 3900 Feet 102733 http://spatialreference.org/ref/esri/102733/
artwork21's user avatar
  • 35.1k
5 votes

Why does Find_SRID return zero?

Complementing with 3 "as it's": 1. As John's answer of 2014, SRID of 0 doesn't technically exist, it just means no SRID — ie, the default if you forget to set it. Zero is a valid SRID, ...
Peter Krauss's user avatar
  • 2,302
5 votes
Accepted

Transform to SRID 900913

If you run, using your original geometry: SELECT ST_AsText( ST_GeomFromEWKT('...
John Powell's user avatar
  • 13.7k
5 votes

Converting 32639 spatial reference to 3857 in PostGIS

What you're doing with your first statement select st_transform(geom,3857) from block_1 is selecting all the rows, transformed to a new CRS. If you do this, you'll note that it is in your expected ...
Alex Leith's user avatar
  • 13.5k
5 votes

SRID and Name relationship

I use http://spatialreference.org and http://www.epsg-registry.org. spatialreference.org has the spatial reference information in numerous formats: And EPSG has an access database you download:
Jay Cummins's user avatar
  • 14.6k
5 votes

Using WGS 84 (SRID 4326) or Web Mercator (SRID 3857)

Having different representation systems was indispensable when only paper maps were produced. Now, with digital maps, that need was divided into two: One is to define geometric properties on objects ...
Gabriel De Luca's user avatar
5 votes
Accepted

Transformation on insertion into PostGIS

If your column is seen as registered in the PostGIS geometry|geography_columns system View (meaning that its constraints are known in the system relations), the typemod constraints of the data type (...
geozelot's user avatar
  • 30.3k
5 votes
Accepted

Missing geometry type and SRID in PostGIS

You will need to explicitly cast the calculated geometries as the correct type, including their typemods, or PostgreSQL will not register the typemods in the View: SELECT a, ST_Union(geom)::...
geozelot's user avatar
  • 30.3k
5 votes
Accepted

How to reproject a table using PostGIS

You need to alter the table column and transform the data in one step: ALTER TABLE pts ALTER COLUMN geom TYPE Geometry(Point, 4326) USING ST_Transform(geom, 4326);
Ian Turton's user avatar
  • 81.8k
4 votes

What SRID is this?

Perhaps CH1903 / LV03C-G (aka EPSG:21782)?
Joseph's user avatar
  • 75.9k
4 votes

Postgis - Spatial relationships in metres

Your query: select st_distance(st_geomfromtext('POINT(150.9319747 -33.8482439)', 3557), st_geomfromtext('POINT(151.9319747 -34.8482439)', 3557)) is not transforming the geometry. You are just ...
amball's user avatar
  • 1,542

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