Skip to content

Commit 27edb8c

Browse files
committed
Support mapbox style definitions
This adds partial support for - mapbox style definitions - compressed tiles - MVT in MBTiles
1 parent 09cda31 commit 27edb8c

File tree

83 files changed

+16688
-9155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+16688
-9155
lines changed

build.gradle

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ buildscript {
99
mavenLocal()
1010
}
1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.6.0'
12+
classpath 'com.android.tools.build:gradle:4.1.0'
1313
classpath 'ch.poole.gradle:markdown-gradle-plugin:0.2.3'
1414
classpath 'org.jacoco:org.jacoco.core:0.8.5'
1515
classpath "ch.poole:preset-utils:0.23.1"
1616
classpath 'com.github.ksoichiro:gradle-eclipse-aar-plugin:0.3.1'
17-
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:1.0.0'
17+
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:2.0.0'
1818
classpath 'com.jaredsburrows:gradle-spoon-plugin:1.5.0'
19+
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.16'
1920
}
2021
}
2122

@@ -47,6 +48,7 @@ apply plugin: 'ch.poole.gradle.markdown'
4748
apply plugin: 'jacoco'
4849
apply plugin: 'com.getkeepsafe.dexcount'
4950
apply plugin: 'com.jaredsburrows.spoon'
51+
apply plugin: 'com.google.protobuf'
5052

5153
markdownToHtml {
5254
sourceDir = new File(projectDir.getPath() + '/documentation/docs/help')
@@ -293,6 +295,24 @@ android {
293295
}
294296
}
295297

298+
ext {
299+
googleProtobufVersion = "3.12.2"
300+
}
301+
302+
protobuf {
303+
protoc {
304+
// pre-packaged protoc
305+
artifact = "com.google.protobuf:protoc:$googleProtobufVersion"
306+
}
307+
generateProtoTasks {
308+
all().each {
309+
task -> task.builtins {
310+
java { }
311+
}
312+
}
313+
}
314+
}
315+
296316
ext {
297317
adb = android.getAdbExe().toString()
298318
}
@@ -408,6 +428,8 @@ dependencies {
408428
implementation "com.drewnoakes:metadata-extractor:2.13.0"
409429
implementation "com.google.code.gson:gson:2.8.5"
410430
implementation 'com.google.protobuf:protobuf-java:3.12.2'
431+
implementation "com.google.code.gson:gson:2.8.6"
432+
implementation "com.google.protobuf:protobuf-java:$googleProtobufVersion"
411433
implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
412434
implementation ('com.faendir.rhino:rhino-android:1.6.0') { exclude group: 'org.mozilla' }
413435
implementation "org.mozilla:rhino:1.7.13"
@@ -421,6 +443,7 @@ dependencies {
421443
implementation 'ch.poole.android:numberpicker:1.0.10'
422444
implementation 'ch.poole.android:numberpickerpreference:2.0.1'
423445
implementation "ch.poole.osm:JosmFilterParser:0.5.1"
446+
implementation 'ch.poole.android:sprites:0.0.4'
424447
implementation 'de.westnordost:countryboundaries:1.5'
425448
implementation 'com.github.sevar83:indeterminate-checkbox:1.0.5@aar'
426449
implementation 'de.ruedigermoeller:fst:2.57'
@@ -429,6 +452,7 @@ dependencies {
429452
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
430453
implementation 'io.michaelrocks:libphonenumber-android:8.12.22'
431454
implementation 'io.noties.markwon:core:4.5.1'
455+
432456
// for temp stuff during dev
433457
// implementation(name:'alibrary', ext:'jar')
434458

@@ -490,21 +514,21 @@ task jacocoTestReport(type:JacocoReport, dependsOn: "testCurrentDebugUnitTest")
490514

491515
description = "Generate Jacoco coverage reports"
492516

493-
classDirectories = fileTree(
517+
classDirectories.from = fileTree(
494518
dir: 'build/intermediates/javac/currentDebug/classes/',
495519
excludes: ['**/R.class', '**/R$*.class', '**/*$ViewInjector*.*', '**/BuildConfig.*', '**/Manifest*.*'])
496520

497-
additionalSourceDirs = files(coverageSourceDirs)
498-
sourceDirectories = files(coverageSourceDirs)
499-
executionData = fileTree(
521+
additionalSourceDirs.from = files(coverageSourceDirs)
522+
sourceDirectories.from = files(coverageSourceDirs)
523+
executionData.from = fileTree(
500524
dir : "$buildDir",
501525
include : ['jacoco/testCurrentDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/CURRENT/*coverage.ec', 'spoon-output/currentDebug/coverage/merged-coverage.ec'])
502526
reports {
503527
xml.enabled = true
504528
html.enabled = true
505529
}
506530

507-
sourceDirectories = files(coverageSourceDirs)
531+
sourceDirectories.from = files(coverageSourceDirs)
508532
}
509533

510534
spoon {
@@ -518,7 +542,7 @@ spoon {
518542
ignoreFailures = true
519543
clearAppDataBeforeEachTest = true
520544
// set these for individual text execution
521-
// className = "de.blau.android.layer.LayerDialogTest"
545+
className = "de.blau.android.layer.mvt.MvtTest"
522546
// methodName = "dataLayerPrune"
523547
}
524548

documentation/docs/help/en/Introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Note that for overlapping objects (such as a node on a way) the selection menu c
8181

8282
#### Selected objects: Moving a Node or Way
8383

84-
Once you have selected an object, it can be moved. Note that objects can be dragged/moved only when they are selected. Simply drag near (i.e. within the tolerance zone of) the selected object to move it. If you select the large drag area in the preferences, you get a large area around the selected node that makes it easier to position the object.
84+
Once you have selected an object, it can be moved. Note that objects can be dragged/moved only when they are selected. Simply drag near (i.e. within the tolerance zone of) the selected object to move it. If you select the large drag area in the [preferences](Preferences.md), you get a large area around the selected node that makes it easier to position the object.
8585

8686
#### Adding a new Node/Point or Way
8787

@@ -210,7 +210,7 @@ The mode can be enabled by long pressing on the lock item, see [Lock, unlock, mo
210210

211211
### Configuring checks
212212

213-
Currently there are two configurable checks (there is a check for FIXME tags and a test for missing type tags on relations that are currently not configurable) both can be configured by selecting "Validator settings" in the "Preferences".
213+
Currently there are two configurable checks (there is a check for FIXME tags and a test for missing type tags on relations that are currently not configurable) both can be configured by selecting "Validator settings" in the [preferences](Preferences.md).
214214

215215
The list of entries is split in to two, the top half lists "re-survey" entries, the bottom half "check entries". Entries can be edited by clicking them, the green menu button allows adding of entries.
216216

documentation/docs/help/en/Main map display.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,45 @@ Note: the map tiles are cached on device and only deleted if explicitly flushed.
3232

3333
Vespucci currently supports a tiled background imagery layer, a tiled overlay layer, a grid/scale layer, a task layer, a photo layer, a GeoJSON layer, a GPX/GPS layer and, naturally, an OSM data layer. Tapping the layer control (upper right corner) will display the layer dialog).
3434

35-
Currently it is not possible to change the ordering or add more than one layer of a specific type. The layer dialog supports the following:
35+
The layer dialog supports the following:
3636

3737
* Hide/Show button turns drawing of the layer off/on. Hiding a layer doesn't free any resources associated with the layer.
3838
* Zoom to extent. Zooms and pans the screen so that the whole extent of the layer is displayed, if the extent cannot be determined this will zoom out to the full web-mercator coverage. Note: on the data layer this may not be particularly useful if you have downloaded areas that are far apart.
3939
* Menu button.
4040
* Tile based layers:
41-
* __Select imagery__ Same contents as the corresponding preference screen, if multiple layers have been used, a most-recently-used list will be displayed above this menu entry, allowing quick layer switching. Selecting the "None" entry from the list will disable the layer, and requires re-enabling it via the "+" button on the layer dialog.
42-
* __Add imagery from OAM__ Query OAM for layers in the current map view and display a list allowing to add them to the local configuration
41+
* __Select imagery__ Show a imagery selection dialog, if multiple layers have been used, a most-recently-used list will be displayed above this menu entry, allowing quick layer switching.
4342
* __Flush tile cache__ Flush the on device cache for this layer.
4443
* __Background properties__ Set contrast of layer.
4544
* __Info__ Display information on the currently selected imagery.
46-
* GeoJSON layer.
45+
* Mapbox Vector Tile layers (additionally to the above):
46+
* __Change style__ Show the layer styling dialog (disabled if a style has been loaded).
47+
* __Load style__ Load a mapbox-gl style.
48+
* GeoJSON layers:
4749
* __Change style__ Show the layer styling dialog.
48-
* __Discard__ Delete the layer including any saved state.
50+
* __Info__ Display some information on the contents.
4951
* GPX layer. The GPX layer is currently mainly controlled via the entries in the GPS menu.
5052
* __Change style__ Show the layer styling dialog.
51-
* Photo, Grid and Task layers.
53+
* Photo, Grid and Task layers:
5254
* __Configure...__ (for the Grid and Task layers)
5355
* __Disable__ Turn this layer off. For the tasks and photo layers this will free resources if the app is exited and re-started.
54-
* Data layer.
56+
* Data layer:
5557
* __Configure...__ Allows selection and configuration of the current OSM data sources. Same contents as the corresponding preference screen.
56-
* Data and Tasks layers.
57-
* __Prune__ remove downloaded data from storage that is outside of the current screen.
58+
* __Info__ Display some information on the contents.
59+
* Data and Tasks layers:
60+
* __Prune__ remove downloaded data from storage that is outside of the current screen and unmodified.
61+
* All layers:
62+
* __Discard__ Delete the layer including any saved state.
63+
* __Up__ move the layer up, potentially obscuring data from lower layers.
64+
* __Down__ move the layer down.
5865
* __+__ button:
59-
* for disabled layers it will show a corresponding "Add ..." entry that will turn the layer on.
60-
* Load GeoJSON layer. Loads a GeoJSON layer from a file, any existing one will be replaced.
61-
62-
Besides the background layer you can add a "overlay" layer between the background and the OSM data, for example a layer showing buildings without an address.
66+
* for disabled layers that can only be displayed once it will show a corresponding "Enable ..." entry that will turn the layer on.
67+
* Add GeoJSON layer. Loads a GeoJSON layer from a file in to a new GeoJSON layer.
68+
* Add background imagery layer. Adds a tile based imagery layer from the internal configuration, which can be from ELI or JOSM, or a custom imagery layer.
69+
* Add overlay imagery layer. As above but assumes that the layer is partially transparent.
70+
* Add imagery from OAM. Add a layer from the OpenAerialMap catalogue. *(requires network connectivity)*
71+
* Add imagery from WMS. This allows you to add a specific layer from a WMS endpoint. *(requires network connectivity)*
72+
73+
Custom tile layers, including on device MBTile containers can be added in the [preferences](Preferences.md).
6374

6475
### Highlighting of data issues
6576

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
## Vespucci Mapbox-GL Style Support
2+
3+
Only one vector tile source is currently supported, all other source configuration is ignored.
4+
5+
Supported layers: _background_, _fill_, _fill-extrusion_, _line_, _symbol_
6+
7+
_fill-extrusion_ layers are treated as flat fill layers
8+
9+
Unsupported layers: raster, circle, heatmap, hillshade, sky
10+
11+
Unsupported attributes are ignored.
12+
13+
Font selection is not supported, we render with a standard Android system font.
14+
15+
None of the new "expression" functions are currently supported, however "old style" filter expressions are supported and interpolation linear, identity and exponential interpolation for numbers, colors and categories work for lots of the supported attributes.
16+
17+
#### Further caveats
18+
19+
While a number of styles and corresponding vector tile schemas have been tested and within the limits described on this page things work, following specific points should be taken in to account:
20+
21+
- the support was mainly intended for relatively light weight QA data overlays, as this is based on Android Canvas rendering and not a purpose specific OpenGL rendering implementation performance will in general be slow. This is further confounded by many sources providing tiles up to a maximum of zoom level 14, these then tend to be very large and often contain far more data than what would be needed for the current view.
22+
- we've implemented some simple label and icon collision detection, however if a collision is detected, we simply doesn't render one of the colliding objects without attempting to relocate the offending symbol (collision avoidance). Further there is currently a hard wired limit of 200 objects that are handled by this, any further ones are not rendered (the choice of limit is not of any particular significance).
23+
- there is currently no TileJSON support.
24+
25+
### Style attributes
26+
27+
|Key | Value | Support | Notes
28+
|---------------------------|-----------|-----------|----------------------------------------------------------------
29+
|__version__ | | yes | ignored
30+
|__sprite__ | | yes |
31+
32+
### Layer attributes for supported layers
33+
34+
Value support:
35+
36+
- __l__ literal
37+
- __z__ "legacy" zoom based interpolation function
38+
- __m__ moustache replacement
39+
- __f__ "legacy" filter expressions
40+
41+
42+
|Key | Values | Support | Notes
43+
|---------------------------|-----------|-----------|----------------------------------------------------------------
44+
|_All layers_ | |
45+
|__minzoom__ | l | yes
46+
|__maxzoom__ | l | yes
47+
|__ref__ | l | yes | missing from mapbox documentation
48+
|__visibility__ | l | yes
49+
|__interactive__ | l | yes | missing from mapbox documentation
50+
|---------------------------+-----------+-----------+----------------------------------------------------------------
51+
|_background_ | |
52+
|__background-color__ | l z | yes
53+
|__backgroud-opacity__ | l z | yes
54+
|__background-pattern__ | l z | yes
55+
|---------------------------+-----------+-----------+----------------------------------------------------------------
56+
|_Vector/geometry tile layers_ | |
57+
|__filter__ | f | yes
58+
|__source-layer__ | l | yes
59+
|---------------------------+-----------+-----------+----------------------------------------------------------------
60+
|_fill_ | |
61+
|__fill-antialias__ | l | yes
62+
|__fill-color__ | l z | yes
63+
|__fill_opacity__ | l z | yes
64+
|__fill-outline-color__ | l z | yes
65+
|__fill-pattern__ | l z | yes
66+
|__fill-sort-key__ | | no
67+
|__fill-translate__ | l z | yes
68+
|__fill-translate-anchor__ | | no
69+
|---------------------------+-----------+-----------+----------------------------------------------------------------
70+
|_fill-extrusion_ | |
71+
|__fill-extrusion-base__ | | no
72+
|__fill-extrusion-color | l z | yes
73+
|__fill-extrusion-height | | no
74+
|__fill-extrusion-opacity | l z | yes
75+
|__fill-extrusion-pattern | l z | yes
76+
|__fill-extrusion-translate | l z | yes
77+
|__fill-extrusion-translate-anchor | | no
78+
|__fill-extrusion-vertical-gradient | | no
79+
|---------------------------+-----------+-----------+----------------------------------------------------------------
80+
|_line_ | |
81+
|__line-blur__ | | no |
82+
|__line-cap__ | l z | yes
83+
|__line_color__ | l z | yes
84+
|__line-dasharray__ | l | yes
85+
|__line-gap-width__ | | no
86+
|__line-gradient__ | | no
87+
|__line-join__ | l z | yes
88+
|__line-miter-limit__ | | no
89+
|__line-offset__ | | no
90+
|__line-opacity__ | l z | yes
91+
|__line-pattern__ | | no
92+
|__line-round-limit__ | | no
93+
|__line-sort-key__ | | no
94+
|__line-translate__ | | no
95+
|__line-translate-anchor__ | | no
96+
|__line-width__ | l z | yes
97+
|---------------------------+-----------+-----------+----------------------------------------------------------------
98+
|_symbol_ | |
99+
|__icon-allow-overlap__ | | no
100+
|__icon-anchor__ | l z | yes
101+
|__icon-color__ | | no
102+
|__icon-halo-blur__ | | no
103+
|__icon-halo-color__ | | no
104+
|__icon-halo-width__ | | no
105+
|__icon-ignore-placement__ | | no
106+
|__icon-image__ | l m z | yes
107+
|__icon-keep-upright__ | | no
108+
|__icon-offset__ | l z | yes
109+
|__icon-opacity__ | | no
110+
|__icon-optional__ | | no
111+
|__icon-padding__ | | no
112+
|__icon-pitch-alignment__ | | no
113+
|__icon-rotate__ | l z | yes
114+
|__icon-rotation-alignment__| | no
115+
|__icon-size__ | l z | yes
116+
|__icon-text-fit__ | | no
117+
|__icon-text-fit-padding__ | | no
118+
|__icon-translate__ | | no
119+
|__icon-translate-anchor | | no
120+
|__symbol-avoid-edges__ | | no
121+
|__symbol-placement__ | l z | yes
122+
|__symbol-sort-key__ | | no
123+
|__symbol-spacing__ | | no
124+
|__symbol-z-order__ | | no
125+
|__text-allow-overlap__ | | no
126+
|__text-anchor__ | l z | yes | just "top" and "bottom" supported
127+
|__text-color__ | l z | yes
128+
|__text-field__ | l m | yes
129+
|__text-font__ | | no
130+
|__text-halo-blur__ | | no
131+
|__text-halo-color__ | l z | yes
132+
|__text-halo-width__ | l z | yes
133+
|__text-ignore-placement__ | | no
134+
|__text-justify__ | l z | yes | "auto" not supported
135+
|__text-keep-upright__ | | no
136+
|__text-letter-spacing__ | l z | yes
137+
|__text-line-height__ | | no
138+
|__text-max-angle__ | | no
139+
|__text-max-width__ | l z | yes
140+
|__text-offset__ | l z | yes
141+
|__text-opacity__ | l z | yes
142+
|__text-optional__ | | no
143+
|__text-padding__ | | no
144+
|__text-pitch-alignment__ | | no
145+
|__text-radial-offset__ | | no
146+
|__text-rotate__ | | no
147+
|__text-rotation-alignment__| | no
148+
|__text-size__ | l z | yes
149+
|__text-transform__ | l z | yes
150+
|__text-translate__ | | no
151+
|__text-translate-anchor__ | | no
152+
|__text-variable-anchor__ | | no
153+
|__test-writing-mode__ | | no

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
android.useAndroidX=true
22
org.gradle.jvmargs=-Xmx6144m
33
android.enableJetifier=true
4-
android.enableUnitTestBinaryResources=true

gradle/wrapper/gradle-wrapper.jar

5.75 KB
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Thu Feb 02 15:02:00 CET 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

0 commit comments

Comments
 (0)