Running Mapnik on Windows

Further to my recent post here…
https://community.openstreetmap.org/t/rendering-tiles-with-mapnik-on-windows/3752/2

I now have just about everything set up for Windows. I had to use the Wayback machine to get most of the binaries I need.

I am running Mapnik 2.2.0.
I am not very familiar, and used this page as guidance (which I also did the first time around)
http://openstreetmapserverwindows.blogspot.com/2015/11/osmopenstreetmap-tile-server.html

I have the world boundaries that I found in the section Tile Rendering from the above link.

I am now getting an error…
RuntimeError: failed to initialize projection with: ‘+init=epsg:4326’ encounter
ed during parsing of layer ‘necountries’ in Layer at line 58 of ‘osm.xml’

It appears I have to keep the existing osm.xml in place, as I can’t generate a new one. I am running the mapnik with…

cd \OpenStreetMap\mapnik-stylesheets-master

set PATH=H:\OpenStreetMap\mapnik-v2.2.0\lib;%PATH%
set PATH=H:\OpenStreetMap\mapnik-v2.2.0\bin;%PATH%

set PYTHONPATH=H:\OpenStreetMap\mapnik-v2.2.0\python\2.7\site-packages;%PYTHONPATH%
set PATH=c:\Python27;%PATH%

set MAPNIK_TILE_DIR=H:\OpenStreetMap\tiles
set MAPNIK_MAP_FILE=output_osm.xml

generate_xml.py osm.xml output_osm.xml --host localhost --user myuser --dbname osm --symbols symbols/ --world_boundaries world_boundaries/ --port 5432 --prefix osm --password mypassword

(I have removed my user and my password for security)

This is in a batch file.

I then found I needed to install something else, though there appears to be issues. OSGeo4. But, I am now stuck. I apparently need to set a path to proj4 gdal bin and nad, but I can’t find any details about what this is. The OSGeo4 install directory doesn’t have proj4, but it does have gdal, but not bin and nad inside there.

I would really like to get this running again on Windows, as I know very little about Linux.

Well, there’s a fairly big red flag right there…

It strikes me that now would be an excellent chance to learn.

You’re trying to follow a blogpost from 7 years ago, which seems to be based on what most people moved away from after 2012 or so.

What are you trying to do here? If it’s a “see if it can be done” kind of thing like running Doom on a TV remote control or crossing the Andes by frog then fair enough, but if you’re actually trying to create a useful map, not so much. Previously I suggested WSL, but Docker’s also an option.

2 Likes

I know I had this all working a few years ago. Now, because I know little (to nothing) of Linux, and I am a Windows programmer, I would prefer to get it going on Windows.

I am nearly there with it all. To be fair, I can’t see how the process would have changed so much… just that Mapnik is no longer being built for Windows (hence having to use the Wayback machine). The data would be more-or-less the same (just updated), and creating tiles should just work the same (using the styles and xml files).

It’s not like I am trying to use my old Windows Mobile device to create these things.

Are there any guides to using WSL or Docker (on Windows)?

I don’t want to be buying another machine (just to install Linux) if I can help it, as I will hardly use it otherwise. I have a Macbook I barely use (I only use it to compile apps for the iPhone, and I would not know how to use it to create tiles, or even to use the Machook to use the space I have on my Windows box). I have tons of disk space on this Windows box which is why I am using it. The generated tiles will be hosted on a separate IIS Web Server.

Is there a book, or anything I can use, from start to finish… to generate my tiles (including setting up a Linux server if I have to)? To be fair, there have been many blockages in many stages (that I would also experience in Linux land), such as on Geofabrik, there are no shape files for Great Britain and Ireland (as one unit).

Like The Martian, fix one problem at a time and move onto the next one. I have progressively fixed all the problems so far that have been thrown at me, and moving to the next, but for this one, I am stuck. I can’t find a lot of detail about EPSG:4326 or how to fix it, as I don’t even know what it means… apart from it is a projection.

With the macbook it should be quite comfortable, but I didn’t use it for years now. Install homebrew, then brew install postgis and postgres and osm2pgsql and mapnik and you should be done. Homebrew will give you hints when installing, like how to start the db as a service and similar.

I will be happy to use the Macbook, but I know very little about how a Mac works.

I will look into the Homebrew.

As I have postgres installed on my Windows machine, and the data imported already, am I able to somehow connect to my Windows Postgres from my Macbook to run Mapnik? Also, am I able to create the tiles to my Windows drive, as I probably don’t have the space on the Macbook?

| Pendigo
October 25 |

  • | - |

I will be happy to use the Macbook, but I know very little about how a Mac works.

I will look into the Homebrew.

As I have postgres installed on my Windows machine, and the data imported already, am I able to somehow connect to my Windows Postgres from my Macbook to run Mapnik? Also, am I able to create the tiles to my Windows drive, as I probably don’t have the space on the Macbook?


Visit Topic or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, click here.

you can access the db server running on windows from the mac, personally I would not like to do it because windows blocks stuff as a default and you would have to find out how to allow it. I would store the tiles temporarily on the mac and move them from time to the other machine to free up space, but maybe this is not necessary and you can write to the remote drive without slowing down the creation?

OK, I will look into this.

Is there a guide for newbies anywhere on how to set this all up and get it all going with the least amount of fuss or frustration?

Thanks.

There are several links from the serving tiles section of the switch2osm site.

As I mentioned previously, I wrong this about setting up the “standard” rendering stack on WSL ages ago.
For Docker see here and here.

There are plenty of people running postgres databases on Windows, as it sounds like you are already. Accessing that remotely is likely just down to setting up the Windows firewall and any necessary permissions; but I can’t really help with that.

This ^^ is all just for “osm-style” raster tiles, of course - there are a whole bunch of other options out there in addition to that, although I suspect that (a) the documentation is less good and (b) the windows support is no better.