Changes between Version 15 and Version 16 of RenderingOsmData
- Timestamp:
- Aug 2, 2010, 8:08:18 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RenderingOsmData
v15 v16 24 24 * 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) 25 25 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 26 34 === Download the osm-mapserver utils === 27 35 … … 35 43 36 44 We'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 ===== 38 47 39 48 {{{ … … 45 54 }}} 46 55 56 47 57 Now log into the created database (as postgres user): 48 58 … … 62 72 }}} 63 73 74 ===== On a windows system ===== 75 1. 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 77 2. Start-->"Program"-->"PostgreSQL 8.x"-->"pgAdmin III". 78 79 3. Connect to the server. 80 81 4. Go to the server's "Databases" tree node, right click, "New Database...", a window titled "New Database..." will be opened. 82 83 5. Enter "osm" in the name field. 84 85 6. Select the template "template_postgis" in the template field combo box. 86 87 7. Press the "OK" button on the new database window. 88 89 8. Select with the mouse the new osm database under the Databases subtree. 90 91 9. From the main menu select: Tools-->"Query tool". 92 93 10. Enter the following text in the "Query tool": 94 95 {{{ 96 create user "www-data" with password 'www-data'; 97 }}} 98 99 11. Press F5 to run the query. 100 101 Leave the "Query tool" on - you will need it later to run more queries. 102 64 103 ==== 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. 66 107 67 108 * 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): … … 71 112 }}} 72 113 114 73 115 * Postprocess the imported data: 74 116 75 117 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 76 119 77 120 {{{ … … 80 123 }}} 81 124 125 82 126 Note that you can also use "WRAP [character] MAXLENGTH [integer]" wrap names on hyphen. 83 127 84 128 Then proceed with postprocessing: 85 129 130 ===== On a debian-ish system ===== 86 131 {{{ 87 132 # cat mapserver-utils-read-only/postprocess.sql | psql -d osm 88 133 }}} 89 134 135 ===== On windows systems system ===== 136 1. Open the file named postprocess.sql in a text editor. 137 2. Copy the text to the "Query tool". 138 3. Press F5 to run the query. 90 139 91 140 == Creating the Mapfile == 92 141 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.142 Open the folder of "osm-mapserver utils" you downloaded earlier. 143 144 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 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. 96 145 97 146 You may need to edit the mapfile to change the EXTENT parameter to suit your own data. To find the correct extent, run this command: … … 108 157 }}} 109 158 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) 112 163 # make 113 164 }}} 114 165 115 check that you now have a full mapfile, named ''osm .map'', and that all the paths and database accesses are ok by running :166 check that you now have a full mapfile, named ''osm-mapserver.map'', and that all the paths and database accesses are ok by running : 116 167 {{{ 117 168 # /path/to/mapserver/shp2img -m osm.map -o osm.png 118 169 }}} 170 171 If you get permission denied errors probably you will need to edit the file. 119 172 120 173 ''osm.png'' should be an image centered on sydney