NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I want to use Mapnik to draw custom styled maps from OSM. I have used Osmosis to import the Europe extract (from geofabric). I used the database schema with linestrings geometries for ways. Now, for performance and convinience reasons (work in QGIS) I want to build materialized views for polygon features, such as water areas. So, for example, for riverbanks I am trying something like this:

SELECT st_buildarea(st_collect(w.linestring)) AS geom
FROM relations r
JOIN relation_members rm ON r.id = rm.relation_id AND rm.member_type = 'W' AND rm.member_role IN ('outer', 'inner')
JOIN ways w ON w.id = rm.member_id
WHERE r.tags->'waterway'='riverbank'
GROUP BY r.id

And the result is:

LWGEOM_GEOS_buildArea: TopologyException: Input geom 1 is invalid: Self-intersection at or near point 0.68302757542791204 46.349042878781603 at 0.68302757542791204 46.349042878781603

And the PostGIS is right, the relation 1085106 is self-intersecting ("inner" way intersects "outer" way). But OSM got it drawn anyway: http://www.openstreetmap.org/#map=20/46.34904/0.68303 As far as I know, Mapnik needs polygons, so the official map have to "fix" these data somehow to draw them. How is this done?

asked 29 Jun '16, 09:01

rouen_sk's gravatar image

rouen_sk
51114
accept rate: 0%

Why not use osm2pgsql which already does the polygon processing?

(29 Jun '16, 14:27) SK53 ♦
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×230
×165
×134

question asked: 29 Jun '16, 09:01

question was seen: 2,732 times

last updated: 29 Jun '16, 14:27

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum