Saturday, May 23. 2015
Printer Friendly
Things are shaping up nicely in PostGIS 2.2 development. We are going to hit feature freeze around June 30th 2015, and plan to ship late August or early September to be in line with PostgreSQL 9.5 release.
So far we have committed a couple of neat features most itemized in PostGIS 2.2 New Functions.
Many of the really sort after ones will require PostgreSQL 9.5 and GEOS 3.5. The geography measurement enhancements will require Proj 4.9.0+ to take advantage of.
Things I'd like to highlight and then later dedicate full-length articles in our BostonGIS Waiting for PostGIS 2.2 series once they've been stress tested.
- ST_SubDivide - chops up your geometry into smaller ones and returns as a set of geometries. You can divide your lines, polygons whatever specifying the max number of vertices you want in each resultant geometry. It's really fast and easy to use. This will come in handy for those long roads (pgRouting I'm looking at you) or you need to chop up large polygons you need to divide to improve intersect performance among other things. Stay tuned for an article. Warning: You can't use this unless you built PostGIS 2.2 with Geos 3.5.0 (still in development).
- ST_ClipByBox2D - ST_SubDivide borrows some logic from this one. This one is generally harder to use, but you do get a bit more control on where you want to make your cuts. Already covered this in ST_ClipByBox2D Map Dicing redux. again you don't get this unless you are running GEOS 3.5+
- KNN distance operator for geography (with true distance, not just bounding box) - We've had KNN for geometry 2D since 2.0 (though it was only limited to bounding box centroid) and now we have it for geography as well and in addition it is a true distance check, not just bounding box. Requries PostgreSQL 9.5 running PostGIS 2.2 to get this feature.
- KNN distance operator for geometry 3D - KNN for geometry 3D - we've had this for geometry 2D since 2.0 and now we have a set of new operators for geometry 3D. Note that since both 2D geometries and 3D geometries share the same type we needed to define a new operator construct for these.
So for 3D distance use
<<->> and <<#>> instead of <-> . If you are running on PostGIS 2.2, you also automagically get true distance check. You should also use an ND index to get full benefit from these.
- True KNN distance for geometry - (no longer limited to bounding box). This is both an enhancement and a possible breaking change for some.
In a nutshell what this means is instead of doing:
WITH cte (SELECT a.field1, a.geom
FROM a ORDER BY a.geom <-> ST_GeomFromText(...) LIMIT 1000)
SELECT field1, geom FROM cte ORDER BY ST_Distance(geom, ST_GeomFromText(...)) LIMIT 100;
Doing the following is sufficient for 9.5+ PostGIS 2.2:
SELECT a.field1, a.geom
FROM a ORDER BY a.geom <-> ST_GeomFromText(...) LIMIT 100;
No more need for that ugly hack of WITH cte(... ORDER BY <-> .. LIMIT 1000) SELECT ... ORDER BY ST_Distance(..) LIMIT 100 or guessing how big to make the first hop if you have linestrings. This feature utilizes the new KNN with RECHECK logic which was recently committed on both the PostgreSQL 9.5 code base and the PostGIS 2.2 codebase. I'll be doing some performance benchmarks of this with real workloads in coming weeks and user testing would also be greatly appreciated.
- ST_AsTWKB: New compressed binary output vector format optimized for web mapping. Basic details of specification here. Why do we need yet another format when we've got GeoJSON. Because when you've got big fat geometries, GeoJSON is just too bulky. Expect a companion Leaflet plugin (and possibly an OpenLayers 3 one to take advantage of this new feature).
- Enhancements to many of the Geography measurement functions ST_Area, ST_Distance: requires Proj 4.9.0. I haven't setup winnie with the new Proj 4.9, so can't speak much about these yet. Stayed tuned.
- Raster -- yap raster continues to innovate- In 2.2. you can build overviews right in the db with ST_CreateOverview and also Retile right in db as well
with ST_Retile.
- Lots of stuff going on in SFCGAL. For sure, SFCGAL will be installable as an extension in PostGIS 2.2 and that has been committed. We expect to see many new functions in PostGIS 2.2, but they have not been committed yet. Things like ST_3DUnion I'm really excited about.
- ST_AsX3D now supports GeoCoordinates and flipping x/y coordinates. Currently only GD WE is supported. I've only tested with X3dom.js and very minimally
- Tiger Geocoder -- updated for Tiger 2014, but I expect Census Tiger data 2015 to come before 2.2 release and hope to update to support that.
- Address Standardizer -- Now a part of PostGIS. More on these later.
|