Osm2pov/Installation on Mac OS X 10.6.5

From OpenStreetMap Wiki
Jump to navigation Jump to search

information sign

The 3D Development team are currently working on unifying 3D related tags.
For first results see Simple 3D Buildings.

OSM2POV is a converter that produces 3D files for PovRay basing upon OSM geodatas.

This page shows how I get osm2pov to work on my Mac (Mac OS X 10.6.5, Snow Leopard). This solution is quick and dirty; it is neither the only nor the best way to accomplish this; improvements are appreciated.

Prerequisites

Update GCC/G++

You need gcc/g++ V4.3 or higher in order to support the most recent C++ standard (compiler flag -std=c++0x), but Apple uses 4.2.1 by default.

If you have installed Darwin, you just need to get gcc44 by running sudo port install gcc44. This may take some time (on my 3 year-old iMac about 30 minutes).

Save the old g++ link by running sudo mv /usr/bin/g++ /usr/bin/g++.old

Then replace the smybolic link to /usr/bin/g++ by sudo ln -sf /opt/local/bin/g++-mp-4.4 g++. Please note that this replaces the standard g++ compiler V4.2.1 provided by Apple.

Install Boost lib

Download the free Boost C++ library for Mac OS X.

Download OSM2POV sources

  1. Get the source via git clone https://github.com/guerda/osm2pov.git.
  2. Add a symbolic link to the include dir of the Boost lib in the osm2pov base dir: osm2pov$ ln -s <path_to_boost_lib>/boost_1_45_0/boost boost

Adaptions to the source code

Changes in Makefile

  1. Add the Boost include path: Insert line INCLUDES = -Iboost in the Makefile

Changes in Global.h

  1. Replace #include <cstdint> with #include <boost/cstdint.hpp>
  2. Same for #include <boost/unordered_map.hpp> and #include <boost/unordered_set.hpp>

Changes in Primitives.h

  1. Add line using namespace boost; at least before the declaration of class Primitives.
  2. Change private member in class Primitives from unordered_map<string,string> tags; to boost::unordered_map<string,string> tags;.

The code should compile and link now. You can check it by running ./osm2pov <osm_file> <pov_file>

Installing povray in MacOS 10.7

If you have the problem that the renderings generated with povray are empty or at least incomplete you should try compiling with clang (using homebrew for example):

sudo brew install povray --use-clang

See also [README of osm-isometric-3d] for more information to setup rendering.

See also