Mapgen.pl/Installation

From OpenStreetMap Wiki
Jump to navigation Jump to search

New installation guide by g0ldfish

Debian Squeeze (minimal installation, only standard system tools)

Login as root

For CPAN configuration: Debian packages sudo, build-essential

$ apt-get install sudo build-essential

Use visudo to grant sudo rights, e.g. full sudo rights for group:

$ visudo

Add new line containing

%groupname ALL=(ALL) ALL

save with Ctrl-o, quit visudo with Ctrl-x

Login as user

Set up CPAN to use as non-root user: Start CPAN, let it configure automatically, then choose appropriate download servers. After that change make_install_make_command and mbuild_install_build_command manually so that the commands are executed with sudo.

$ cpan
cpan [x]> o conf make_install_make_command 'sudo /usr/bin/make'
cpan [x]> o conf mbuild_install_build_command 'sudo ./Build'
cpan [x]> o conf commit

(see also http://learnperl.scratchcomputing.com/tutorials/configuration/)

Quit CPAN

cpan [x]> q

Use local::lib to create module tree in home directory (version # may differ)

$ wget http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.008004.tar.gz
$ tar xfz local-lib-1.008004.tar.gz
$ cd local-lib-1.008004/
$ perl Makefile.PL --bootstrap=~/.perl
$ make test && sudo make install
$ echo 'eval $(perl -I$HOME/.perl/lib/perl5 -Mlocal::lib=$HOME/.perl)' >> ~/.bashrc

(see also [1])

Login in again

For Mapgen: Debian packages: libcompress-bzip2-perl, libgd-graph3d-perl, proj

$ sudo apt-get install libcompress-bzip2-perl libgd-graph3d-perl proj
$ cpan
cpan [x]> install Math::Polygon 
cpan [x]> install Geo::Proj4 
cpan [x]> install DBI
cpan [x]> install LWP::Simple

Old information gathered by many users

Easiest way is to set up SVN access!

  • HINT: the *.pm files go into a subfolder "OSM"
  • Math::Polygon can be obtained from CPAN http://search.cpan.org/dist/Math-Polygon/
  • GD installation: sudo apt-get install libgd-graph3d-perl
  • bzip2 installation: sudo apt-get install libcompress-bzip2-perl
  • Geo::Proj4: (not working on Windows!)
    • sudo apt-get install proj
    • sudo apt-get install proj-data
    • cpan<enter>, then install Geo::Proj4
      • May result in error (No makefile found)
      • cd ~/.cpan/build/Geo-Proj4*
      • perl Makefile.PL
      • make && make test && make install

Following programs only needed if directory PDFs will be created

  • latex:sudo apt-get install texlive-latex-base
  • dvips: sudo apt-get install texlive-latex-bin
  • ps2pdf: sudo apt-get install texlive-latex-bin

Files

Topo Style

Install on GNU/Linux

Download the files above and

  • Put the mapgen.pl file in a folder
  • Put dir.pl and mapgenRules.csv in the same folder
  • Make a subfolder called OSM and put all *.pm files there (can also be put into a directory contained in the @INC pathes)
  • Make a subfolder called Math (can also be put into a directory contained in the @INC pathes)


Use the Perl cpan software to download additional modules needed:

  • Start a terminal and type cpan <Enter> (better sudo cpan ???)
  • If this is the first time running cpan, follow instructions to configure it
  • When configuration is done there should be a cpan[x]> prompt visible and waiting for commands
  • Write get Math::Polygon to install the Polygon module (better install instead of get???)
  • Write get Geo::Proj4 to install the Proj4 module (better install ???)
  • Write q to quit the cpan software


Check that BZ2 and GD support is installed on your computer:

  • For bzip2 installation run sudo apt-­get install libcompress­-bzip2-­perl
  • For GD installation run sudo apt-­get install libgd-­graph3d­-perl


Now there are some optional software needed depending on what you want to do.

  • If you want to use only a part of an OSM-file, you need to install osmosis. Take care that it can be invoked from command line
  • If you are using SVG files as tile patterns or when converting from SVG to PNG or PDF, you need to install inkscape by running sudo apt-get install inkscape. Take care that it can be invoked from command line


If you want to have the Street directory in PDF format, you'll also need the following:

  • latex: sudo ap-t­get install texlive-­latex­-base
  • dvips: sudo apt-­get install texlive­-base
  • ps2pdf: sudo apt-­get install texlive­-recommended