Mapyrus

From OpenStreetMap Wiki
Jump to navigation Jump to search
Bedford area, rendered using Mapyrus

This page is about OJW's OpenStreetMap renderer. Mapyrus itself can be found here

Mapyrus is a vector drawing tool written in Java. It takes input from a script file, and generates output in a variety of bitmap and vector graphics formats.

In its simplest form, the input file is just LOGO commands (move to x,y while drawing a thick red line). However, the complexity of input files can be increased to the level of loops, variables, functions, etc.

Functions in Mapyrus

Point data

Points, or sets of points, can be used for drawing symbols, labels, etc.

Polylines

Polyline support in Mapyrus is extremely strong. In addition to the usual colour, width, style options, it is easy to create parallel lines (e.g. for sidewalks, or for shading beaches). It can flow text around a polyline. It can also create elements at intervals along a line, e.g. symbols, labels, or for creating (say) a line composed of small squares.

Fenced-off compound in grey. Also testing speckle effects on the hedgerows (somewhat exaggerated)

Areas

Areas can be created, filled, filled with a pattern, or can create lines inside or outside the edge of an area (e.g. like access land on OS maps), and the centre of an area can be found (e.g. to place labels)

Images

Georeferenced images can be displayed

Icons

Icons can be loaded from image files and easily displayed. However it doesn't seem to support transparent icons.

Geodata formats

Mapyrus can handle a number of geographic data file formats, such as Shapefiles and text files, and it can download data from a database with geographic extensions. OJW's renderer is not using those functions, and uses a Perl program to read OSM data, and supply it to Mapyrus as drawing commands.

Bath. The lake within the park uses elevation tag to place itself on top of the grass area

Non overlapping labels

The Mapyrus programming language has functions for marking an area as "protected", then testing whether a potential location for something would infringe on a protected area before deciding whether to draw it.

Geomaths extensions

A java geographics math library can be used by Mapyrus, allowing it to calculate intersections, unions, etc. between various elements, such as "is this point within the woodland", "is this street within the built-up area"

The renderer

Source code

Feature status

25m contour map of the Solent area
Ways roads, footpaths, train lines, rivers and coastline
Road outlines naive
Areas Basic support, including the elevation tag
Vector icons Creating Mapyrus icon set
Raster icons Stalled due to lack of transparency support
Area textures none
Contours Researching
Scalebar Available, but difficult to position correctly
Grid lines not available
Coastline shading none