Skip to content

Commit aac2478

Browse files
committed
Use Wikimedia Maps server instead of Mapbox.
See issue commons-app#590 This switches to using the Wikimedia tile server for providing map data. It comes with a couple of drawbacks which are currently unavoidable, but such is the way of open-source... - The WMF map server does not provide vector tiles, or rather it doesn't provide vectors that are compatible with the Mapbox SDK :( - It provides only one "theme" of tiles, so you will no longer have a dark vs. light theme.
1 parent 3b8e3b3 commit aac2478

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

app/src/main/assets/mapstyle.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": 8,
3+
"sources": {
4+
"wikimedia-osm": {
5+
"type": "raster",
6+
"tiles": [
7+
"https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png"
8+
],
9+
"tileSize": 128
10+
}
11+
},
12+
"layers": [
13+
{
14+
"id": "background",
15+
"type": "background",
16+
"paint": {
17+
"background-color": "#606060"
18+
}
19+
},
20+
{
21+
"id": "osm",
22+
"type": "raster",
23+
"source": "wikimedia-osm"
24+
}
25+
]
26+
}

app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import android.graphics.Color;
44
import android.net.Uri;
55
import android.os.Bundle;
6-
import android.preference.PreferenceManager;
76
import android.view.LayoutInflater;
87
import android.view.View;
98
import android.view.ViewGroup;
@@ -99,11 +98,8 @@ private void setupMapView(Bundle savedInstanceState) {
9998

10099
addCurrentLocationMarker(mapboxMap);
101100
});
102-
if (PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("theme",false)) {
103-
mapView.setStyleUrl(getResources().getString(R.string.map_theme_dark));
104-
} else {
105-
mapView.setStyleUrl(getResources().getString(R.string.map_theme_light));
106-
}
101+
102+
mapView.setStyleUrl("asset://mapstyle.json");
107103
}
108104

109105
/**

0 commit comments

Comments
 (0)