Changes between Version 15 and Version 16 of RenderingOsmData


Ignore:
Timestamp:
Aug 2, 2010, 8:08:18 AM (14 years ago)
Author:
assaframan
Comment:

Added information how to get this working on windows

Legend:

Unmodified
Added
Removed
Modified
  • RenderingOsmData

    v15 v16  
    2424 * Optionally, download and unzip the shapefiles containing the world coastlines from http://hypercube.telascience.org/~kleptog/processed_p.zip (this shapefile isn't included or rendered with the supplied mapfile)
    2525
     26==== Windows downloads ====
     27 
     28 * Download and install [http://www.cygwin.com cygwin] and make sure you add the following packages: "wget", "unzip", "gcc".
     29
     30 * Download and install [http://www.postgresql.org/download/windows PostgreSQL] for windows and select to install PostGIS in PostgreSQL setup.
     31
     32 * If you don't have MapServer for windows - install it - just make sure you have the latest version of MapServer and not an old one...
     33
    2634=== Download the osm-mapserver utils ===
    2735
     
    3543
    3644We'll assume that the data will be imported into a database named {{{osm}}}. We will also grant access to a {{{www-data}}} user.
    37 On a debian-ish system, this goes like:
     45
     46===== On a debian-ish system =====
    3847
    3948{{{
     
    4554}}}
    4655
     56
    4757Now log into the created database (as postgres user):
    4858
     
    6272}}}
    6373
     74===== On a windows  system =====
     751. If you haven't installed it yet - install PostgreSQL for windows with PostGIS extension (you can select to add PostGIS during the PostgreSQL setup).
     76
     772. Start-->"Program"-->"PostgreSQL 8.x"-->"pgAdmin III".
     78
     793. Connect to the server.
     80
     814. Go to the server's "Databases" tree node, right click, "New Database...", a window titled "New Database..." will be opened.
     82
     835. Enter "osm" in the name field.
     84
     856. Select the template "template_postgis" in the template field combo box.
     86
     877. Press the "OK" button on the new database window.
     88
     898. Select with the mouse the new osm database under the Databases subtree.
     90
     919. From the main menu select: Tools-->"Query tool".
     92
     9310. Enter the following text in the "Query tool":
     94 
     95{{{
     96create user "www-data" with password 'www-data';
     97}}}
     98
     9911. Press F5 to run the query.
     100
     101Leave the "Query tool" on - you will need it later to run more queries.
     102
    64103==== Importing the OSM data ====
    65  * Install the [http://wiki.openstreetmap.org/wiki/Osm2pgsql Osm2pgsql] helper program
     104 * Install the [http://wiki.openstreetmap.org/wiki/Osm2pgsql Osm2pgsql] helper program
     105 
     106 * On windows make sure that PROJ_LIB environment variable is define to the location of your epsg file (In some case the path is: "C:\ms4w\proj\nad") - else you will get a "Projection code failed to initialise" error.
    66107
    67108 * Run the importation process (as the postgres user) (this will take some time, depending on your processing power and the quantity of data you want to import):
     
    71112}}}
    72113
     114
    73115 * Postprocess the imported data:
    74116
    75117 Optionally, edit mapserver-utils-read-only/postprocess.sql to comment out or remove the following two lines if you'd rather leave names unchanged:
     118
    76119
    77120{{{
     
    80123}}}
    81124
     125
    82126 Note that you can also use "WRAP [character] MAXLENGTH [integer]" wrap names on hyphen.
    83127
    84128 Then proceed with postprocessing:
    85129
     130===== On a debian-ish system =====
    86131{{{
    87132# cat mapserver-utils-read-only/postprocess.sql | psql -d osm
    88133}}}
    89134
     135===== On windows systems system =====
     1361. Open the file named postprocess.sql in a text editor.
     1372. Copy the text to the "Query tool".
     1383. Press F5 to run the query.
    90139
    91140== Creating the Mapfile ==
    92141
    93 checkout the mapfile and dependencies from http://code.google.com/p/mapserver-utils/source/checkout
    94 
    95 this is a work in progress mapfile, that compiles a template and a style file into a full-blown MapServer mapfile. The supplied Makefile supposes that the C preprocessor is installed on your system. The ''fonts.lst'' file contains the path to the two fonts used: adapt to reference similar fonts if the ones in the file don't exist on your system.
     142Open the folder of "osm-mapserver utils" you downloaded earlier.
     143
     144this is a work in progress mapfile, that compiles a template and a style file into a full-blown MapServer mapfile. The supplied Makefile supposes that the C preprocessor is installed on debian-ish systems (or cygwin on windows). The ''fonts.lst'' file contains the path to the two fonts used: adapt to reference similar fonts if the ones in the file don't exist on your system.
    96145
    97146You may need to edit the mapfile to change the EXTENT parameter to suit your own data. To find the correct extent, run this command:
     
    108157}}}
    109158
    110 {{{
    111 # cd mapserverosm
     159 * On windows use cygwin command prompt and you may also need to edit the "Makefile" file first line to be "CPP=cpp".
     160
     161{{{
     162# cd mapserverosm  (or the "osm-mapserver utils" path)
    112163# make
    113164}}}
    114165
    115 check that you now have a full mapfile, named ''osm.map'', and that all the paths and database accesses are ok by running :
     166check that you now have a full mapfile, named ''osm-mapserver.map'', and that all the paths and database accesses are ok by running :
    116167{{{
    117168# /path/to/mapserver/shp2img -m osm.map -o osm.png
    118169}}}
     170
     171If you get permission denied errors probably you will need to edit the file.
    119172
    120173''osm.png'' should be an image centered on sydney