CartoCSS → Mapnik XML
osm
Find a file
2024-06-03 14:07:53 +02:00
app Added icon to warning messages 2017-09-12 08:59:59 +02:00
builder mapnik: fix new simplify_geometries parameter 2024-06-03 14:07:53 +02:00
cmd magnacarto-mapnik: cache loaded mapnik map 2024-04-29 16:23:26 +02:00
color husl-go renamed to hsluv-go 2017-07-24 11:34:12 +02:00
config magnacarto-mapnik: cache loaded mapnik map 2024-04-29 16:23:26 +02:00
docs examples: update titles 2015-09-01 16:01:06 +02:00
maps app: parse SRS from request 2017-07-27 12:07:10 +02:00
mml mapnik: fix new simplify_geometries parameter 2024-06-03 14:07:53 +02:00
mss mss: make ZoomRange.ValidFor public 2023-01-16 13:54:53 +01:00
regression fix regression tests with OGR2 2018-08-07 13:17:39 +02:00
render mapnik: remove debug print statement 2024-05-16 10:46:53 +02:00
vendor vendor: update dependencies 2024-01-24 16:32:49 +01:00
.gitignore ignore magnacarto-mapnik 2015-08-04 14:42:05 +02:00
.travis.yml travis: build with go 1.13 2019-10-11 08:59:36 +02:00
crosscompile.sh crosscompile: do not use godep 2017-08-03 13:13:51 +02:00
doc.go add package doc strings 2015-05-22 14:37:37 +02:00
example-magncarto.tml add missing example-magnacarto.tml (closes #10) 2016-01-14 09:48:06 +01:00
go.mod vendor: update dependencies 2024-01-24 16:32:49 +01:00
go.sum vendor: update dependencies 2024-01-24 16:32:49 +01:00
LICENSE add README and LICENSE 2015-06-11 10:20:49 +02:00
Makefile build: remove -lboost_system, not required anymore 2020-08-19 08:25:36 +02:00
README.md update readme 2024-01-25 09:17:06 +01:00
version.go build: use git tag as version if available 2019-07-04 13:28:07 +02:00

Magnacarto

Magnacarto is a CartoCSS map style processor that generates Mapnik XML and MapServer map files.

It is released as open source under the Apache License 2.0.

Features

  • Easy to use map viewer

Magnaserv

  • Generate styles for Mapnik 3 and MapServer

MapServer

OSM-Bright MapServer

Mapnik

OSM-Bright Mapnik

Current status

  • Supports nearly all features of CartoCSS
    • Attachments
    • Instances
    • Classes
    • Color functions
    • Expressions
    • etc.
  • Can successfully convert complex styles (like the OSM Carto style)

Missing

  • Not all CartoCSS features are supported by the MapServer builder
  • Improved configuration
  • ...

Installation

Source

Dependencies

You need Go>1.12

Compiling

Check out or download the repository and call:

make install

Render Plugins

The web-frontend of Magnacarto can render map images with Mapserver and Mapnik.

Mapserver

The Mapserver plugin is already included in the default magnaserv installation and it requires the mapserv binary in your PATH on runtime.

Mapnik

The Mapnik plugin needs to be compiled as an additional binary (magnacarto-mapnik). You need to have Mapnik installed with all header files. It supports 3. Make sure mapnik-config is in your PATH. Call make install to build the plugin binary.

Usage

magnacarto

magnacarto takes a single -mml file.

magnacarto -mml project.mml > /tmp/magnacarto.xml

To build a MapServer map file:

magnacarto -builder mapserver -mml project.mml > /tmp/magnacarto.map

See magnacarto -help for more options.

magnaserv

Magnaserv is a web-frontend for Magnacarto. Make sure the ./app directory is in your working directory or next to the magnaserv executable.

To start magnaserv on port 7070:

magnaserv

Magnaserv will search for .mml files in the current working directory or in direct sub-directories.

To start magnaserv on port 8080 with the Mapserver plugin enabled:

magnaserv -builder mapserver -listen 127.0.0.1:8080

You can configure the location of stylings, shapefiles or images, and database connection parameters with a configuration file. See example-magnacarto.tml:

magnaserv -builder mapserver -config magnacarto.tml

Proj4 compatibility

Update: v1.3.0 (2024-01-24)

Current libproj versions do not support the old "+init=epsg:3857"-style projection strings anymore. The mapnik3 builder now emits "epsg:3857" by default. You can enable compatibility with older libproj/proj4 versions by using the mapnik3-proj4 builder. Make sure to update the SRS of your layers (in the .mml files) to the new "epsg:3857" style. mapnik3-proj4 will add "+init=" for these SRS.

Documentation

See docs/examples for example files and usage instructions.

Refer to the Carto project for documentation of the CartoCSS format.

Refer to the following CartoCSS projects for larger .mml and .mss examples.

Please note that openstreetmap-carto relies on a few advanced Mapnik features that are not supported by Mapserver. Future versions of Magnacarto might work around these limitations.

Support

Please use GitHub for questions: https://github.com/omniscale/magnacarto/issues

Development

The latest developer documentation can be found here: http://godoc.org/github.com/omniscale/magnacarto

The source code is available at: https://github.com/omniscale/magnacarto/

You can report any issues at: https://github.com/omniscale/magnacarto/issues

Test

Unit tests

go test -short ./...

Regression tests

There are regression tests that generate Mapnik and MapServer map files, renders images and compares them. These tests require Image Magick (compare) and MapServer >=7 (shp2img).

go test ./...