Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapnik parsing error for a xml generated by carto #132

Open
bogdanul2003 opened this issue Jan 23, 2017 · 8 comments
Open

Mapnik parsing error for a xml generated by carto #132

bogdanul2003 opened this issue Jan 23, 2017 · 8 comments

Comments

@bogdanul2003
Copy link

bogdanul2003 commented Jan 23, 2017

I have generated a xml style sheet using carto/project.mml > mapnik.xml

Whe I run a python script in order to render a pbf file I get an error while it parses the mapnik.xml file:

`#!/usr/bin/env python
import mapnik
from mapnik import *

mapnik.logger.set_severity(mapnik.severity_type.Debug)
mapfile = 'mapnik.xml'
map_output = 'mymap33.png'
m = Map(2048, 2048)
load_map(m, mapfile)
bbox=(Box2d( 26.08901,44.420234,26.125488,44.435067))
#m.zoom_to_box(bbox)
render_to_file(m, map_output)`

The error is this:
`Mapnik LOG> 2017-01-20 08:07:18: Unable to process some data while parsing 'mapnik.xml':

  • attribute 'minimum-scale-denominator' with value '750000' at line 0
  • attribute 'maximum-scale-denominator' with value '750000' at line 0
  • attribute 'maximum-scale-denominator' with value '3000000' at line 0
  • attribute 'minimum-scale-denominator' with value '750000' at line 0
  • attribute 'maximum-scale-denominator' with value '500000000' at line 0
  • attribute 'minimum-scale-denominator' with value '50000000' at line 0
  • attribute 'maximum-scale-denominator' with value '6500000' at line 0
  • attribute 'minimum-scale-denominator' with value '750000' at line 0
  • attribute 'maximum-scale-denominator' with value '750000' at line 0
  • attribute 'maximum-scale-denominator' with value '50000' at line 0
  • attribute 'maximum-scale-denominator' with value '100000' at line 0
  • attribute 'maximum-scale-denominator' with value '3000000' at line 0
  • attribute 'minimum-scale-denominator' with value '200000' at line 0
  • attribute 'maximum-scale-denominator' with value '50000000' at line 0
  • attribute 'maximum-scale-denominator' with value '50000000' at line 0
  • attribute 'maximum-scale-denominator' with value '750000' at line 0
  • attribute 'maximum-scale-denominator' with value '50000000' at line 0
  • attribute 'maximum-scale-denominator' with value '200000' at line 0
  • attribute 'maximum-scale-denominator' with value '100000' at line 0
  • attribute 'maximum-scale-denominator' with value '100000' at line 0
  • attribute 'maximum-scale-denominator' with value '50000' at line 0
  • attribute 'maximum-scale-denominator' with value '200000' at line 0
  • attribute 'maximum-scale-denominator' with value '200000' at line 0
  • attribute 'maximum-scale-denominator' with value '5000' at line 0
  • attribute 'maximum-scale-denominator' with value '200000' at line 0
  • attribute 'maximum-scale-denominator' with value '100000' at line 0
  • attribute 'maximum-scale-denominator' with value '100000' at line 0
  • attribute 'maximum-scale-denominator' with value '1500000' at line 0
  • attribute 'maximum-scale-denominator' with value '6500000' at line 0
  • attribute 'maximum-scale-denominator' with value '50000' at line 0
  • attribute 'maximum-scale-denominator' with value '100000' at line 0
  • attribute 'maximum-scale-denominator' with value '12500' at line 0
  • attribute 'maximum-scale-denominator' with value '6500000' at line 0
    `
@talaj
Copy link
Member

talaj commented Jan 23, 2017

What version of Mapnik do you have? maximum-scale-denominator was formerly called maxzoom but was renamed in mapnik/mapnik@219ad1f, see mapnik/mapnik#1447.

@bogdanul2003
Copy link
Author

biliuta@ubuntu:~/Downloads/mapnik-3.x$ mapnik-config -v
3.1.0

I compiled the latest source code from master branch so I should have the version that uses maximum-scale-denominator. The parsing is done by the mapnik library in C++ as far as I can understand. Is this correct or it's done in python ?

@talaj
Copy link
Member

talaj commented Jan 23, 2017

The parsing is done by the mapnik library in C++ as far as I can understand. Is this correct or it's done in python ?

Yes, it is done by Mapnik in C++.

You can try to reduce the XML to minimum which still fails and paste it here.

@bogdanul2003
Copy link
Author

bogdanul2003 commented Jan 23, 2017

<Style name="builtup" filter-mode="first"> <Rule> <MaxScaleDenominator>3000000</MaxScaleDenominator> <MinScaleDenominator>750000</MinScaleDenominator> <PolygonSymbolizer fill="#dddddd" /> </Rule> </Style> <Layer name="builtup" maximum-scale-denominator="3000000" minimum-scale-denominator="750000" srs="+proj=merc +datum=WGS84 +over"> <StyleName>builtup</StyleName> <Datasource> <Parameter name="file"><![CDATA[data/world_boundaries/builtup_area.shp]]></Parameter> <Parameter name="type"><![CDATA[shape]]></Parameter> </Datasource> </Layer>

The mapnik.xml file has over 35.000 lines but above I've pasted a piece of it that I think fails.
It's kind of difficult to paste xml files here because I can't format them correctly. If you want I can upload the xml file somewere and send you a link.

@talaj
Copy link
Member

talaj commented Jan 23, 2017

I don't know what's wrong. This piece works for me.

@bogdanul2003
Copy link
Author

Hmmm ... In fact I don't think there is a xml formatting problem. I looked up the error message in the code and it points to find_unused_nodes_recursive() function. Judging by the name of the function and by the way it is used I think mapnik doesn't allow the existence of unused nodes ? And who must use the node maximum-scale-denominator ?

@bogdanul2003
Copy link
Author

Here you can download the xml file:
https://expirebox.com/download/21f7378b9a35cb3491b1b958cb859fe6.html

@bogdanul2003
Copy link
Author

After a short break I got back to mapnik. I checked my install environment and it seemed that I installed the python-mapnik from pip repo and not from source so it wasn't using the mapnik library that I compiled from source. Now I've also compiled python-mapnik from source and using gdb I can see that at run time python loads libmapnik.so.3.1.0 library which has the same md5sum as the one built by me.

This got rid of the error message with which I opened this issue.

I guess this issue can be closed but I still have some problems rendering a first map and I would appreciate if you guys can point me in the right direction. The rendered map is always blank.

I compiled my library for debug and used this python script:

#!/usr/bin/env python

import mapnik
from mapnik import *

mapnik.logger.set_severity(mapnik.severity_type.Debug)

mapfile = 'mapnik.xml'
map_output = 'mymap33.png'

m = Map(2048, 2048)
load_map(m, mapfile)
bbox=(Box2d( 26.08901,44.420234,26.125488,44.435067))

m.zoom_to_box(bbox) 
render_to_file(m, map_output)

if I remove those lines:

bbox=(Box2d( 26.08901,44.420234,26.125488,44.435067))
m.zoom_to_box(bbox) 

I get this error:

0.92ms (cpu 0.07ms)         | postgis_connection::execute_query SELECT oid, typname FROM pg_type WHERE oid = 19553
2.51ms (cpu 0.66ms)         | postgis_datasource::bind(get_column_description)
Mapnik LOG> 2017-02-06 07:57:56: postgis_connection: closing connection (close)- 0x2b41790
29.85ms (cpu 1.56ms)        | postgis_datasource::init
Mapnik LOG> 2017-02-06 07:57:56: agg_renderer: Scale=-inf
Mapnik LOG> 2017-02-06 07:57:56: agg_renderer: Start map processing bbox=box2d(INVALID)
Mapnik LOG> 2017-02-06 07:57:56: agg_renderer: End map processing
Mapnik LOG> 2017-02-06 07:57:56: stroker: Destroy stroker=0x39569b0

Can you please tell me why bbox is initialized with an INVALID parameter? If I don't remove those 2 lines all seems to run correctly but the image is still blank. I've attached the debug output with the 2 lines included in the code.
out.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants