PostGIS 2.5.0 released
postgis.net
postgis.net
Why is the projection ID(SRID/EPSG) situation so horrendously bad?
As far as I can tell, the only way to take a Shapefile and figure out the proper SRID number, is to take the .proj4 file and run it through an API like http://www.prj2epsg.org/search (which spent some number of weeks down earlier this year, and I haven't tried again to see if the API is back up).
It's funny, because you can't actually take in map data in PostGIS without the SRID properly set, and yet there's no reliable way to get the number, so working with multiple projection datasets is just... not possible unless you manually do the conversions?
Honestly, if I could get the data that the API above has, I'd run the service myself to at least make it reliable, even though it requires a lookup. But there should be a better system, somehow.
https://github.com/boundlessgeo/prj2epsg
GeoTools (Java GIS library) has several versions of the EPSG database available as JARs and you can use the CRS class to do lookups in both directions.
https://github.com/boundlessgeo/prj2epsg/blob/master/src/mai...
You may also be able to do a query on the SPATIAL_REF_SYS table in Postgres/PostGIS for what you want to do.
Hope this helps...
The .prj files also contain enough information to figure out projection IDs, and various tools exist to manipulate and extract information from those files.
It looks like that webservice is a wrapper around one or many of those tools.
This however, has nothing to do with PostGIS. PostGIS will ingest any geo data you give it. and if you don't know the SRID you can use -1. As for the problem of Shapefiles there are better alternative formats now like geojson and spatialite based geodatabases that encode SRID in a single file.
As it stands however, everybody and everything can read shape files and that cannot be said about any other format.
Need a standardized way to disseminate data that's super easy to ingest? GeoJSON and KML work great there, while GeoPackage is going to be not a great fit for things like APIs plus you can't do a streaming read.
Need a way to edit and work with data locally and maybe send stuff around your office? Geopackage is going to be a much better fit then GeoJSON or KML.
Source: I wrote a shapefile parser and generator.
Also, most of the data I'm using doesn't have a GeoJSON version publically available- I'm having to trust that someone else converted it correctly, and at a satisfiable resolution.
What do you use to ingest Shapefiles into PostGIS? Can you provide an example with files where you failed?
I also don't see how I could be "doing it bad" since the thing I need to do is to use data from sets that use multiple SRIDs. If I can't reliably pick out the SRID, I also can't reliably bring them all into my DB.
The European Petrolatum Survey Group creates it's own database of these projections (it's literally an sqlite database, filled with XML) for quick reference but this is not a small database so not every place uses it. So you've now got 2 separate ways to talk about projections .prj files (aka WKT) and just EPSG numbers.
Now geo is becoming a 'thing' now so you've also got outsiders coming into the geospatial area without all the legacy baggage aka google, they don't care about projections and local coordinate reference systems because they are working at a global scale, hence google maps tends to do everything in Lat Lons and when it does project things it does it in Web Mercator (EPSG: 3857) which makes every cartography and traditional GIS person die a little inside but on the other hand given what google maps was designed for, is a pretty rock solid choice for doing local directions all over the parts of the world where people live.
And that means that a lot of the innovative stuff in the geo space is either not dealing with projections at all (like big query GIS [1]) and just doing all the calculations on a sphere or is doing bespoke projections based on the data (like D3) and not bothering with the standardized state plane and national projection schemes (which is what GIS people often talk about when they argue about projections even though at the end of the day it's all about just matching the projection to the house projection used by whatever agency is using the data).
I don't know exactly where I was going with this but https://epsg.io is IMHO the best place for finding info on projections, if your prj file doesn't just have a name or a number in it you can easily use.
Source: I maintain proj4js
Ah, government contracting.
ST_QuantizeCoordinates
With this you should be able to store coordinates with whatever precision they come with but get back queries that only care about the 'city level' or 'block level' and can be encoded with an exact number of bytes for a neural net.