lundi 29 décembre 2014

How to transform isolines to isopolygons with postgis?


I have a table a postgis table of isolines that's defined like this:



CREATE TABLE myisolines
(
gid serial NOT NULL,
isotime timestamp without timezone,
val numeric(10,4),
geom geometry(LineString,4326)
);


Visually this linestring objects look like this:


enter image description here


I know the spatial extent of my data, so I can add a Bbox, so the LineStrings can be sort of closed.


enter image description here


I want to create a table of isopolygons myisopolygons from myisolines table, with polygons, that won't overlap but create a continuous surface and have a column val with the lowest val of isolines, from which the polygon was formed. I understand it can be formed from self-closed isoline (island), or isoline closed with bbox, in that case the val should be taken from that particular isoline. Visually it should look like this:


enter image description here


I thought that I can create topology somehow and then transform faces to polygons, but I don't understand how to do it properly. How can this be done?


Another option would be to recursively use a difference function between bbox and each created polygon, but I guess that's not the right way to do it, and definitely not fast at all.





Aucun commentaire:

Enregistrer un commentaire