MapServer

From OpenStreetMap Wiki
Jump to navigation Jump to search
MapServer
FI HKI bus stops Mapserver.jpg
License: MIT License
Platforms: Windows, Linux, and macOS
Status: Active
Version: 7.6.1 (2020-07-31)
Language: multiple languages
Website: https://mapserver.org/
Source code: MapServer/MapServer GitHub
Programming languages: C and C++

MapServer is an Open Source platform for publishing spatial data and interactive mapping applications to the web.

MapServer (https://mapserver.org/) serves maps to clients (such as through a WMS server), and is known as one of the fastest map engines, as it is written in C. You can drop a geojson, geopackage, shapefile, or any vector/raster format supported by GDAL in a dir, in any map projection supported by PROJ and it will get displayed on the map served by MapServer.

Tutorials for serving OSM data with MapServer

Setting up a MapServer at home

  • Windows users can leverage MS4W (MapServer for Windows), an installer that includes Apache, GDAL, PROJ, MapServer, and many tools (including osm2pgsql).

broom

This article or section may contain out-of-date information. The information may no longer be correct, or may no longer have relevance.
If you know about the current state of affairs, please help keep everyone informed by updating this information. (Discussion)

The following steps are necessary to set up Christopher's OSM implementation using MapServer (from a ML-mail[1]).

All the bits for the freemap.in renderer:

  • Requires MapServer to be installed
    • PROJ support required
    • WMS Client support required
  • GDAL must be installed
    • With Python bindings for processing data
  • Requires mapscript PHP bindings

Data processing:

Planet:

python osm2gml_simple.py.txt < planet.osm > planet.gml
  • Run:
ogr2ogr planet.segments.shp planet.gml segments
ogr2ogr planet.ways.shp planet.gml ways

SWBD:

find world_mask/ -name '*.shp' | xargs ogrtindex world_tindex.shp


Once those are complete:

 http://london.freemap.in/map/july.mercator.planet.map

should be set up as a map file. (Drop it into a directory.)

Copy http://london.freemap.in/tile.phps into a web accessible directory. Copy http://london.freemap.in/config.phps into the same directory, and alter:

"osm-july-merc"   => array( "july mercator Planet.osm",
"/www/freemap.in/london/map/july.mercator.planet.map",
                     array( 822116.8933, 411058.4466, 205529.2233,
                     102764.6117, 51382.3058, 25691.1529, 12845.5765,
                     6422.7882, 3211.3941, 1605.6971  ) ,
                                          "PNG24"),

to point to the correct file location. (Don't worry about the scale levels -- they don't matter.)

Copy the HTML from http://london.freemap.in/osm.html and put it somewhere you want it to be.

If you have any questions about completing this process, please email me off list.

I don't have any plans to maintain the current london.freemap.in sites, as I'm told they're no longer useful due to the age of the data. If someone is using this data for something, please let me know, and I will make sure I take care of meeting your needs.

Regards, -- Christopher Schmidt Web Developer