[postgis-users] Approximate union of polygons?
dmj at nrtc.northrop.com
Tue Oct 7 17:13:08 PDT 2008
I have an application that keeps a database of video footprints, one
quadrilateral per frame of video. I consolidate each 5 seconds of video
footprints into a single multipolygon in order to speed up queries for
video of a specified area. That's typically a union of 150 (30fps)
polygons with 4-vertexes. I build this multipolygon with ST_GeomUnion,
and it's acceptably fast. So far, so good.
I've been quite surprised by the variance in the number of vertices in
the resulting multipolygon - sometimes it's as high as 1200. Usually
it's lower than the equvalent set of frame footprints, but not always.
This hasn't been a problem for database queries, but now it's time to
build a user interface and of course the UI has problems displaying that
many vertices. (Actually, the UI is getting the polygons via a SOAP
message, and our web server's SOAP infrastructure often just dies when
the result is so long.) Eyeballing these consolidated polygons, it looks
like keeping only 20-30 vertices would provide an excellent
approximation. (It's quite common for the camera to stare at a single
point for a long time, in which case all the frames are in about the
same location.) This seems like the sort of thing PostGIS would be able
to do but I haven't been able to figure it out from the docs. Does
anyone know if this is possible?
(I've been told the footprints have to consider every frame, so building
the union with one frame per second or similar is out.)
More information about the postgis-users