[postgis-users] Topology: Simplifying Coastlines with Islands
Michiel J. van Heek
michielvanheek at nine-e.org
Tue May 29 05:33:54 PDT 2012
Quoting "Michiel J. van Heek" <michielvanheek at nine-e.org>:
> Quoting Sandro Santilli <strk at keybit.net>:
>
>> On Mon, May 28, 2012 at 02:50:43PM +0200, Michiel J. van Heek wrote:
>>> Quoting Sandro Santilli <strk at keybit.net>:
>> ...
>>>> How do your country boundaries look now ? :)
>>>
>>> They look pretty good. Most remaining trouble edges are relatively
>>> short. Three long coastlines remain problematic: arctic Canada,
>>> southern/eastern USA, and Brazil. (Red color in attached
>>> screenshot.) Probably because they have some quite large islands
>>> very close to the coastline.
>>
>> "Probably" ? Dissipate any dubt, take a closer look !
>> Pick the Brazil coast, looks interesting.
>> Zoom in, see the edge which was colliding in the ST_ChangeEdgeGeom
>> error message.
>
> The collisions that struck me this morning: for the US east coast it
> was Long Island, NY. And for the coast of Brazil it was the island
> of Afua. But I will take another look, and send you some screen
> shots tomorrow, when I am at my other computer.
Hello Sandro,
I am sure you will like these pictures. :-)
Screenshot.png
black: edges that simplified in the first run (tolerance: 0.5 - 0.1)
blue: edges that simplified in the second run (tolerance: 0.5 - 0.1)
green: edge (southern Vietnam) that simplified in the third run
(tolerance: 0.5 - 0.1)
orange: edges that would not simplify with a tolerance of 0.1 or
higher (tried 5 runs)
Screenshot1.png: Long Island, New York (prevents east coast of USA
from simplifying)
Screenshot2.png: Afua islands, Brazil
Screenshot3.png: mouth of the Uruquay River (prevents south coast of
Uruquay from simplifying)
I hope these pictures will help you get a better idea of how to solve
these kind of simplifying challenges.
And finally a question about removing islands. I am using the
procedure below to delete all topography elements that belong to faces
with a bounding box smaller than a certain area (0.5 in this case). Is
it correct? Should we add this to PostGIS as a function?
Michiel
CREATE TABLE topo_ids_temp AS
SELECT
face_id,
edge_id,
node_id
FROM countries_topology_4.face
INNER JOIN countries_topology_4.edge_data
ON ((face_id = left_face) OR (face_id = right_face))
INNER JOIN countries_topology_4.node
ON (start_node = node_id)
WHERE (st_area(mbr) < 0.5)
AND (start_node = end_node)
AND (edge_id NOT IN (
SELECT abs_next_left_edge FROM countries_topology_4.edge_data
WHERE edge_id <> abs_next_left_edge
UNION
SELECT abs_next_right_edge FROM
countries_topology_4.edge_data WHERE edge_id <> abs_next_right_edge
));
DELETE FROM countries_topology_4.edge_data
USING topo_ids_temp
WHERE (countries_topology_4.edge_data.edge_id = topo_ids_temp.edge_id);
DELETE FROM countries_topology_4.face
USING topo_ids_temp
WHERE (countries_topology_4.face.face_id = topo_ids_temp.face_id);
DELETE FROM countries_topology_4.node
USING topo_ids_temp
WHERE (countries_topology_4.node.node_id = topo_ids_temp.node_id);
DROP TABLE topo_ids_temp;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot.png
Type: image/png
Size: 334844 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120529/33fcf7de/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot1.png
Type: image/png
Size: 174765 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120529/33fcf7de/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot2.png
Type: image/png
Size: 164149 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120529/33fcf7de/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot3.png
Type: image/png
Size: 152472 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120529/33fcf7de/attachment-0003.png>
More information about the postgis-users
mailing list