NOTICE: is being shutdown on 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 = rm.relation_id AND rm.member_type = 'W' AND rm.member_role IN ('outer', 'inner')
JOIN ways w ON = rm.member_id
WHERE r.tags->'waterway'='riverbank'

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: 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

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 29 Jun '16, 09:01

question was seen: 2,725 times

last updated: 29 Jun '16, 14:27

NOTICE: is being shutdown on 1st March 2024. Please use the OpenStreetMap Community Forum