Using an Entity causes odd error on Windows

View: New views
6 Messages — Rating Filter:   Alert me  

Using an Entity causes odd error on Windows

by G3YAC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.   I can't get xml entities in style sheets to work on Windows.

I have Mapnik 0.5.1 installed on an Ubuntu 8.10 machine and  Mapnik 0.6.0 on a Windows XP machine.
Both work fine and render osm tiles using the standard python scripts.

However... I can use xml entities in my mapfile on the ubuntu machine but attempting the same thing on the Windows machine results in:

      File "C:\Documents and Settings\Admin\My Documents\Mapping\mapnik\WIN_entity_generate_tiles.py", line 53, in render_tiles
         load_map(m,mapfile)
      UserWarning: Not a map file. Node 'Map' not found.


I used the win32 binary download from: http://download.berlios.de/mapnik/mapnik-0.6.0-win32-py25.zip
and Python reports Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45

The working mapfile first few lines:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE Map>
    <Map bgcolor="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over">
    <Style name="world">...etc

The same few lines of the mapfile that doesn't work on Windows/mapnik 0.6.0 (but does work on Ubuntu/mapnik 0.5.1)
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE Map [
    <!ENTITY Water "#d8f8f8">
    ]>
    <Map bgcolor="#b5d0d0" srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over">
    <Style name="world">...etc

The only difference between the two files is the entity. (To help debug the issue I created the second file from the first and simply pasted in the entity component.)

I expect I'm doing something stupid! Can anyone tell me what it might be? My Google searches suggest that this effect is caused when mapnik is not built with libxml2 (which seems unlikely in the published distribution.)

Thanks,

           Philip
--
Philip Howarth
Cambridge UK
email: Philip at Howarth . name

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Using an Entity causes odd error on Windows

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Philip,


On Jun 5, 2009, at 4:17 PM, Philip Howarth wrote:

> I expect I'm doing something stupid! Can anyone tell me what it  
> might be? My Google searches suggest that this effect is caused when  
> mapnik is not built with libxml2 (which seems unlikely in the  
> published distribution.)

Libxml2 (and hence entities) are not available in the win32 binaries.  
Sorry about that - it is surely a highly requested feature.

The Mapnik 0.6.0 release marked the first release where libxml2 (vs.  
other parsers mapnik previously used) was switched to be the default -  
because XML Entities are so handy.

Artem, who built the Win32 binaries ran into compilation problems, so  
the current parser in the WIN32 binaries is till TinyXML.

If anyone is up for trying to get (and documenting the steps) to get  
libxml2 static libraries build on windows, that might help when we hit  
the next release.

Dane



_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Using an Entity causes odd error on Windows

by G3YAC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks again Dan for giving me the heads up that 0.6.0 doesn't include libxml2.

I presume that when Artem had problems compiling, he found some issue with the win32 distribution at http://xmlsoft.org/sources/win32/  Any idea what the problem was. I *might* be able to persuade a colleague to take a look - if I can just tweak his curiosity enough...

Meanwhile I'll find some way to  preprocess my entity laden mapfile.
 
     Philip

2009/6/6 Dane Springmeyer <blake@...>
Hey Philip,



On Jun 5, 2009, at 4:17 PM, Philip Howarth wrote:

I expect I'm doing something stupid! Can anyone tell me what it might be? My Google searches suggest that this effect is caused when mapnik is not built with libxml2 (which seems unlikely in the published distribution.)

Libxml2 (and hence entities) are not available in the win32 binaries. Sorry about that - it is surely a highly requested feature.

The Mapnik 0.6.0 release marked the first release where libxml2 (vs. other parsers mapnik previously used) was switched to be the default - because XML Entities are so handy.

Artem, who built the Win32 binaries ran into compilation problems, so the current parser in the WIN32 binaries is till TinyXML.

If anyone is up for trying to get (and documenting the steps) to get libxml2 static libraries build on windows, that might help when we hit the next release.

Dane






--
Philip Howarth
Cambridge UK
email: Philip@...
web: www.philip.howarth.name

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Using an Entity causes odd error on Windows

by Lennard-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Philip Howarth wrote:

> Meanwhile I'll find some way to  preprocess my entity laden mapfile.

 From the libxml2 tools:

xmllint --noent your-original.xml >no-entities.xml

Will usually do the trick.

--
Lennard
_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Using an Entity causes odd error on Windows

by G3YAC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Lennard.

I just tried that under cygwin and, after one small false start, it works fine. I needed to add the --c14n option as --noent on its own did the entity substitution OK but left their definitions in place - which the current build of mapnik can't handle.

That just saved me more time Googling for solutions that work in a Windows environment.

Regards,

           Philip

2009/6/6 Lennard <ldp@...>
Philip Howarth wrote:

> Meanwhile I'll find some way to  preprocess my entity laden mapfile.

 From the libxml2 tools:

xmllint --noent your-original.xml >no-entities.xml

Will usually do the trick.

--
Lennard
_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users



--
Philip Howarth
Cambridge UK
email: Philip@...
web: www.philip.howarth.name

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: Using an Entity causes odd error on Windows

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Philip,

No, I'm not sure what the exact problems there were. The pre-processing sounds like a good route for now!

Dane


On Jun 6, 2009, at 1:04 AM, Philip Howarth wrote:

Thanks again Dan for giving me the heads up that 0.6.0 doesn't include libxml2.

I presume that when Artem had problems compiling, he found some issue with the win32 distribution at http://xmlsoft.org/sources/win32/  Any idea what the problem was. I *might* be able to persuade a colleague to take a look - if I can just tweak his curiosity enough...

Meanwhile I'll find some way to  preprocess my entity laden mapfile.
 
     Philip

2009/6/6 Dane Springmeyer <blake@...>
Hey Philip,



On Jun 5, 2009, at 4:17 PM, Philip Howarth wrote:

I expect I'm doing something stupid! Can anyone tell me what it might be? My Google searches suggest that this effect is caused when mapnik is not built with libxml2 (which seems unlikely in the published distribution.)

Libxml2 (and hence entities) are not available in the win32 binaries. Sorry about that - it is surely a highly requested feature.

The Mapnik 0.6.0 release marked the first release where libxml2 (vs. other parsers mapnik previously used) was switched to be the default - because XML Entities are so handy.

Artem, who built the Win32 binaries ran into compilation problems, so the current parser in the WIN32 binaries is till TinyXML.

If anyone is up for trying to get (and documenting the steps) to get libxml2 static libraries build on windows, that might help when we hit the next release.

Dane






--
Philip Howarth
Cambridge UK
email: Philip@...
web: www.philip.howarth.name


_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users