mapnik/mapnik — Issue #1118: Geos WKT rendering errors
Author: pnorman
Created: 2012-03-07 08:51:57+00:00
State: open

Two nearly-identical WKT strings produce drastically different results. One renders the expected shape but the other does not.

The following code generates a triangle. The code below it does not generate any shape, but should produce a practically identical result.

```
import mapnik2 as mapnik

m = mapnik.Map(600,300)
m.background = mapnik.Color('steelblue')
s = mapnik.Style()
r = mapnik.Rule()
polygon_symbolizer = mapnik.PolygonSymbolizer(mapnik.Color('#FF3366'))
r.symbols.append(polygon_symbolizer)
line_symbolizer = mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),1.0)
r.symbols.append(line_symbolizer)
s.rules.append(r)
m.append_style('My Style',s)
#ds = mapnik.Geos(wkt='POLYGON ((-13707837 6309308, -13707837 6318579, -13700216 6318579, -13700216 6309308, -13707837 6309308))')
#ds = mapnik.Geos(wkt='POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))')
ds = mapnik.Geos(wkt='POLYGON((-13707000 0, 10000000 2000000, 0 2000000, -13707000 0))')
layer = mapnik.Layer('world', '+init=epsg:3857')
layer.datasource = ds
layer.styles.append('My Style')
m.layers.append(layer)
m.zoom_all()
mapnik.render_to_file(m,'world.png', 'png')
print "rendered image to 'world.png'"
```
Code that does not work:

```
import mapnik2 as mapnik

m = mapnik.Map(600,300)
m.background = mapnik.Color('steelblue')
s = mapnik.Style()
r = mapnik.Rule()
polygon_symbolizer = mapnik.PolygonSymbolizer(mapnik.Color('#FF3366'))
r.symbols.append(polygon_symbolizer)
line_symbolizer = mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),1.0)
r.symbols.append(line_symbolizer)
s.rules.append(r)
m.append_style('My Style',s)
#ds = mapnik.Geos(wkt='POLYGON ((-13707837 6309308, -13707837 6318579, -13700216 6318579, -13700216 6309308, -13707837 6309308))')
#ds = mapnik.Geos(wkt='POLYGON ((30 10, 10 20, 20 40, 40 40, 30 10))')
ds = mapnik.Geos(wkt='POLYGON((-13707002 0, 10000000 2000000, 0 2000000, -13707002 0))')
layer = mapnik.Layer('world', '+init=epsg:3857')
layer.datasource = ds
layer.styles.append('My Style')
m.layers.append(layer)
m.zoom_all()
mapnik.render_to_file(m,'world.png', 'png')
print "rendered image to 'world.png'"
```

OS is ubuntu 11.10
geos is 3.2.2 installed through apt
mapnik is 2.0.0