Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ If you have any questions or problems, don't hesitate to ask the [forum](https:/
- Java map library
- OpenGL vector-tile rendering
- Themeable vector layers ([render themes](docs/Rendertheme.md))
- Hillshading from HGT digital elevation model data
- Support for multiple tile sources:
- OpenScienceMap vector tiles
- Mapsforge vector maps
- MBTiles vector & raster maps
- Mapbox vector tiles (e.g. Mapilion, Mapzen, Nextzen, OpenMapTiles)
- GeoJSON vector tiles (e.g. Mapzen, Nextzen)
- Raster tiles: any quadtree-scheme tiles as texture
- MBTiles vector & raster
- Mapbox vector tiles
- GeoJSON vector tiles
- OpenScienceMap vector tiles
- Raster tiles
- Backends:
- Android ([example](vtm-android-example))
- iOS (libGDX/RoboVM, [instructions](docs/ios.md))
Expand All @@ -34,13 +35,14 @@ If you have any questions or problems, don't hesitate to ask the [forum](https:/

### Projects
- **vtm** core library
- **vtm-hillshading** hillshading
- **vtm-jts** overlays
- **vtm-http** online tiles
- **vtm-mvt** MBTiles
- **vtm-android** Android backend
- **vtm-android-example** Android examples
- **vtm-gdx** common libGDX backend
- **vtm-android-gdx** Android libGDX backend
- **vtm-desktop** Desktop libGDX backend
- **vtm-desktop-lwjgl** Desktop LWJGL backend
- **vtm-desktop-lwjgl3** Desktop LWJGL 3 backend
- **vtm-playground** Desktop examples
- **vtm-ios** iOS libGDX backend
- **vtm-ios-example** iOS examples
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ allprojects {
group = 'org.mapsforge'
version = 'master-SNAPSHOT'

ext.mapsforgeVersion = "0.24.1"
ext.gdxVersion = "1.11.0"
ext.gwtVersion = "2.8.2"

Expand Down
1 change: 1 addition & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next version

- Hillshading from HGT digital elevation model data [#1189](https://github.com/mapsforge/vtm/pull/1189)
- Motorider map theme improvements [#1183](https://github.com/mapsforge/vtm/issues/1183)
- Rename `MapDatabase` to `MapFile` [#1184](https://github.com/mapsforge/vtm/pull/1184)
- Rename `MultiMapDatabase` to `MultiMapFile`
Expand Down
44 changes: 16 additions & 28 deletions docs/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,41 +26,18 @@ implementation '[PACKAGE]:vtm:[CURRENT-VERSION]'
implementation '[PACKAGE]:vtm-themes:[CURRENT-VERSION]'
```

### Android
## Android

```groovy
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-x86'
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-x86_64'
implementation '[PACKAGE]:vtm-android:[CURRENT-VERSION]'
implementation 'com.caverock:androidsvg:1.4'
```

### Android (libGDX)

```groovy
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-armeabi-v7a'
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-arm64-v8a'
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-x86'
runtimeOnly '[PACKAGE]:vtm-android:[CURRENT-VERSION]:natives-x86_64'
implementation '[PACKAGE]:vtm-android:[CURRENT-VERSION]'
implementation '[PACKAGE]:vtm-gdx:[CURRENT-VERSION]'
runtimeOnly '[PACKAGE]:vtm-android-gdx:[CURRENT-VERSION]:natives-armeabi-v7a'
runtimeOnly '[PACKAGE]:vtm-android-gdx:[CURRENT-VERSION]:natives-arm64-v8a'
runtimeOnly '[PACKAGE]:vtm-android-gdx:[CURRENT-VERSION]:natives-x86'
runtimeOnly '[PACKAGE]:vtm-android-gdx:[CURRENT-VERSION]:natives-x86_64'
implementation '[PACKAGE]:vtm-android-gdx:[CURRENT-VERSION]'
implementation 'com.badlogicgames.gdx:gdx:1.11.0'
implementation 'com.badlogicgames.gdx:gdx-backend-android:1.11.0'
implementation 'com.caverock:androidsvg:1.4'
```

### iOS

Detailed iOS instructions can be found [here](ios.md).

### Desktop
## Desktop

```groovy
implementation '[PACKAGE]:vtm-gdx:[CURRENT-VERSION]'
Expand All @@ -74,7 +51,7 @@ implementation 'guru.nidi.com.kitfox:svgSalamander:1.1.3'
implementation 'net.sf.kxml:kxml2:2.3.0'
```

#### Desktop (LWJGL 2)
### LWJGL 2

```groovy
implementation '[PACKAGE]:vtm-desktop-lwjgl:[CURRENT-VERSION]'
Expand All @@ -85,7 +62,7 @@ runtimeOnly 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-osx'
runtimeOnly 'org.lwjgl.lwjgl:lwjgl-platform:2.9.3:natives-windows'
```

#### Desktop (LWJGL 3)
### LWJGL 3

```groovy
implementation '[PACKAGE]:vtm-desktop-lwjgl3:[CURRENT-VERSION]'
Expand All @@ -96,7 +73,18 @@ runtimeOnly 'org.lwjgl:lwjgl:3.3.1:natives-macos'
runtimeOnly 'org.lwjgl:lwjgl:3.3.1:natives-windows'
```

### JTS overlays
## Features

### Hillshading

```groovy
implementation '[PACKAGE]:vtm-hillshading:[CURRENT-VERSION]'
implementation 'org.mapsforge:mapsforge-core:0.24.1'
implementation 'org.mapsforge:mapsforge-map:0.24.1'
implementation 'org.mapsforge:mapsforge-map-android:0.24.1'
```

### Overlays

```groovy
implementation '[PACKAGE]:vtm-jts:[CURRENT-VERSION]'
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ include ':vtm-desktop-lwjgl3'
include ':vtm-extras'
include ':vtm-gdx'
include ':vtm-gdx-poi3d'
include ':vtm-hillshading'
include ':vtm-http'
//include ':vtm-ios'
//include ':vtm-ios-example'
Expand Down
3 changes: 3 additions & 0 deletions vtm-android-example/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
<activity
android:name=".GdxPoi3DActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name=".HillshadingActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<!--<activity
android:name=".JeoIndoorActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />-->
Expand Down
4 changes: 3 additions & 1 deletion vtm-android-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dependencies {
implementation project(':vtm-android')
implementation project(':vtm-android-mvt')
implementation project(':vtm-extras')
implementation project(':vtm-hillshading')
implementation project(':vtm-http')
//implementation project(':vtm-jeo')
implementation project(':vtm-json')
Expand All @@ -15,7 +16,8 @@ dependencies {
implementation project(':vtm-gdx')
implementation project(':vtm-gdx-poi3d')

implementation 'org.mapsforge:mapsforge-poi-android:0.24.0'
implementation "org.mapsforge:mapsforge-map-android:$mapsforgeVersion"
implementation "org.mapsforge:mapsforge-poi-android:$mapsforgeVersion"
}

android {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
* Copyright 2025 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.android.test;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
import org.mapsforge.map.android.graphics.AndroidGraphicFactory;
import org.mapsforge.map.android.hills.DemFolderAndroidContent;
import org.mapsforge.map.layer.hills.AdaptiveClasyHillShading;
import org.mapsforge.map.layer.hills.DemFolder;
import org.oscim.android.cache.TileCache;
import org.oscim.backend.CanvasAdapter;
import org.oscim.core.MapPosition;
import org.oscim.core.Tile;
import org.oscim.layers.tile.bitmap.BitmapTileLayer;
import org.oscim.layers.tile.buildings.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.map.Viewport;
import org.oscim.renderer.BitmapRenderer;
import org.oscim.renderer.GLViewport;
import org.oscim.scalebar.*;
import org.oscim.theme.internal.VtmThemes;
import org.oscim.tiling.ITileCache;
import org.oscim.tiling.source.hills.HillshadingTileSource;
import org.oscim.tiling.source.mapfile.MapFileTileSource;
import org.oscim.tiling.source.mapfile.MapInfo;

import java.io.FileInputStream;
import java.util.logging.Logger;

/**
* Standard map view with hill shading.
*/
public class HillshadingActivity extends MapActivity {

private static final Logger log = Logger.getLogger(HillshadingActivity.class.getName());

private static final boolean USE_CACHE = false;

private static final int SELECT_MAP_FILE = 0;
private static final int SELECT_DEM_DIR = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// Select map file
Toast.makeText(this, "Select map file", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, SELECT_MAP_FILE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

if (requestCode == SELECT_MAP_FILE) {
if (resultCode != Activity.RESULT_OK || data == null) {
finish();
return;
}

try {
Uri uri = data.getData();

MapFileTileSource tileSource = new MapFileTileSource();
//tileSource.setPreferredLanguage("en");
FileInputStream fis = (FileInputStream) getContentResolver().openInputStream(uri);
tileSource.setMapFileInputStream(fis);

VectorTileLayer tileLayer = mMap.setBaseMap(tileSource);
mMap.setTheme(VtmThemes.MOTORIDER);

mMap.layers().add(new BuildingLayer(mMap, tileLayer));
mMap.layers().add(new LabelLayer(mMap, tileLayer));

DefaultMapScaleBar mapScaleBar = new DefaultMapScaleBar(mMap);
mapScaleBar.setScaleBarMode(DefaultMapScaleBar.ScaleBarMode.BOTH);
mapScaleBar.setDistanceUnitAdapter(MetricUnitAdapter.INSTANCE);
mapScaleBar.setSecondaryDistanceUnitAdapter(ImperialUnitAdapter.INSTANCE);
mapScaleBar.setScaleBarPosition(MapScaleBar.ScaleBarPosition.BOTTOM_LEFT);

MapScaleBarLayer mapScaleBarLayer = new MapScaleBarLayer(mMap, mapScaleBar);
BitmapRenderer renderer = mapScaleBarLayer.getRenderer();
renderer.setPosition(GLViewport.Position.BOTTOM_LEFT);
renderer.setOffset(5 * CanvasAdapter.getScale(), 0);
mMap.layers().add(mapScaleBarLayer);

MapInfo info = tileSource.getMapInfo();
if (!info.boundingBox.contains(mMap.getMapPosition().getGeoPoint())) {
MapPosition pos = new MapPosition();
pos.setByBoundingBox(info.boundingBox, Tile.SIZE * 4, Tile.SIZE * 4);
mMap.setMapPosition(pos);
mPrefs.clear();
}

// Select DEM folder
Toast.makeText(this, "Select DEM folder", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
| Intent.FLAG_GRANT_PREFIX_URI_PERMISSION
);
startActivityForResult(intent, SELECT_DEM_DIR);
} catch (Exception e) {
log.severe(e.toString());
finish();
}
} else if (requestCode == SELECT_DEM_DIR) {
if (resultCode != Activity.RESULT_OK || data == null)
return;

Uri uri = data.getData();

DemFolder demFolder = new DemFolderAndroidContent(uri, this, getContentResolver());
final AdaptiveClasyHillShading algorithm = new AdaptiveClasyHillShading()
// You can make additional behavior adjustments
.setAdaptiveZoomEnabled(true)
// .setZoomMinOverride(0)
// .setZoomMaxOverride(17)
.setCustomQualityScale(1);
HillshadingTileSource hillshadingTileSource = new HillshadingTileSource(Viewport.MIN_ZOOM_LEVEL, Viewport.MAX_ZOOM_LEVEL, demFolder, algorithm, 128, Color.BLACK, AndroidGraphicFactory.INSTANCE);
if (USE_CACHE) {
ITileCache tileCache = new TileCache(this, getExternalCacheDir().getAbsolutePath(), "hillshading");
hillshadingTileSource.setCache(tileCache);
}
mMap.layers().add(new BitmapTileLayer(mMap, hillshadingTileSource, 150));
mMap.clearMap();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ protected void onCreate(Bundle savedInstanceState) {

linearLayout.addView(createLabel(null));
linearLayout.addView(createButton(LocationTextureActivity.class));
linearLayout.addView(createButton(HillshadingActivity.class));
linearLayout.addView(createButton(PoiSearchActivity.class));
linearLayout.addView(createButton(MapsforgeStyleActivity.class));
linearLayout.addView(createButton(MapsforgeS3DBActivity.class));
Expand Down
25 changes: 25 additions & 0 deletions vtm-hillshading/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apply plugin: 'java-library'
apply plugin: 'maven-publish'

dependencies {
api project(':vtm')
api "org.mapsforge:mapsforge-map:$mapsforgeVersion"
}

sourceSets {
main.java.srcDirs = ['src']
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}

if (project.hasProperty("SONATYPE_USERNAME")) {
afterEvaluate {
project.apply from: "${rootProject.projectDir}/deploy.gradle"
}
}
Loading