XAML-Map-Control/MapsforgeTiles
2026-02-23 16:47:53 +01:00
..
Avalonia Removed TileRenderer class 2026-02-23 16:47:53 +01:00
Shared Removed TileRenderer class 2026-02-23 16:47:53 +01:00
UWP Updated MapsforgeTiles projects 2026-02-15 00:09:21 +01:00
WinUI Removed TileRenderer class 2026-02-23 16:47:53 +01:00
WPF Removed TileRenderer class 2026-02-23 16:47:53 +01:00
pom.xml Updated MapsforgeTiles projects 2026-02-15 00:09:21 +01:00
README.md Removed TileRenderer class 2026-02-23 16:47:53 +01:00

MapsforgeTiles

Tile source libraries for loading map content from vector map files.

The MapsforgeTileSource class in these libraries uses parts of the Mapsforge Java library, which is made accessible to .NET via IKVM, a Java Virtual Machine for .NET. Mapsforge is published under a simplified variant of the LGPL v3 license.

Map files can be downloaded from the Mapsforge Download Server.

MapsforgeTileSource is initialized by a static Initialize method that takes the file path to either a single map file or a directory containing multiple map files, and a DPI scale factor that controls the size of the rendered map tiles.

The MapsforgeTileSource instance constructor takes a string parameter that specifies a Mapsforge theme. This is either the full path of an XML rendertheme file, or the name of one of the built-in themes (ignoring case), e.g. Default. See MapsforgeThemes.java for available theme names. The second and third optional constructor parameters specify the size of the tile source's internal tile cache and the relative scale of rendered text.

Code sample:

MapControl.MapsforgeTiles.MapsforgeTileSource.Initialize(".\mapfiles", 1.5f);

map.MapLayer = new MapTileLayer
{
    TileSource = new MapControl.MapsforgeTiles.MapsforgeTileSource("Default")
};

While building with IKVM's MavenReference succeeds, running a RenderThemeFuture always fails with a NoClassDefFoundError exception for org.xmlpull.v1.XmlPullParserFactory.

An alternative approach is to import Mapsforge classes by an IkvmReference that references a local JAR file with all required dependencies. This JAR is built from pom.xml in the MapsforgeTiles directory, by a custom PreBuild event in the project files which executes the command

mvn package

So in order to build the MapsforgeTiles libraries, a Maven installation is required.