Skip to content

Commit 1a88709

Browse files
authored
Merge pull request #653 from Esri/Ting/FixOSMWarnings
[Update] Fix warnings related to OpenStreetMap styles being deprecated
2 parents d5a4bfc + 8ea1b43 commit 1a88709

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

Shared/Samples/Configure basemap style parameters/ConfigureBasemapStyleParametersView.swift

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct ConfigureBasemapStyleParametersView: View {
2020
@StateObject private var model = Model()
2121

2222
/// The selected basemap style language strategy.
23-
@State private var selectedLanguage: BasemapStyleLanguage = .strategic(.global)
23+
@State private var selectedLanguage: BasemapStyleLanguage = .strategic(.local)
2424

2525
var body: some View {
2626
MapView(map: model.map)
@@ -68,7 +68,7 @@ struct ConfigureBasemapStyleParametersView: View {
6868
}
6969
.menuOrder(.fixed)
7070
.labelStyle(.titleAndIcon)
71-
.onChange(of: selectedLanguage) {
71+
.onChange(of: selectedLanguage, initial: true) {
7272
model.setBasemapLanguage(selectedLanguage)
7373
}
7474
}
@@ -78,19 +78,16 @@ private extension ConfigureBasemapStyleParametersView {
7878
/// The model used to store the geo model and other expensive objects
7979
/// used in this view.
8080
class Model: ObservableObject {
81-
/// A map with OpenStreetMap light gray basemap.
81+
/// A an empty map with an initial viewpoint.
8282
let map: Map = {
83-
let map = Map(
84-
basemap: Basemap(
85-
// An OpenStreetMap basemap style is used to support localization.
86-
style: .osmLightGray,
87-
// Set the language strategy to global to use English.
88-
parameters: BasemapStyleParameters(language: .strategic(.global))
89-
)
83+
let map = Map()
84+
// Start with a viewpoint around Bulgaria, Greece, and Turkey.
85+
// They use three different alphabets: Cyrillic, Greek, and Latin,
86+
// respectively. The scale is set to Metropolitan Area level.
87+
map.initialViewpoint = Viewpoint(
88+
center: Point(x: 2_640_000, y: 4_570_000),
89+
scale: 288895.277144
9090
)
91-
// Start with a viewpoint over Bulgaria, Greece, and Turkey.
92-
// They use three different alphabets: Cyrillic, Greek, and Latin, respectively.
93-
map.initialViewpoint = Viewpoint(center: Point(x: 3_000_000, y: 4_500_000), scale: 1e7)
9491
return map
9592
}()
9693

@@ -105,7 +102,7 @@ private extension ConfigureBasemapStyleParametersView {
105102
/// - Parameter language: The language setting for the basemap.
106103
func setBasemapLanguage(_ language: BasemapStyleLanguage) {
107104
let parameters = BasemapStyleParameters(language: language)
108-
map.basemap = Basemap(style: .osmLightGray, parameters: parameters)
105+
map.basemap = Basemap(style: .arcGISLightGray, parameters: parameters)
109106
}
110107
}
111108
}

Shared/Samples/Configure basemap style parameters/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ When creating an application that is used in multiple countries, basemaps can re
1010

1111
## How to use the sample
1212

13-
This sample showcases the workflow of configuring basemap style parameters by displaying a basemap with labels in different languages and launches with a `Viewpoint` set over Bulgaria, Greece, and Turkey, as they use three different alphabets: Cyrillic, Greek, and Latin, respectively. By default, the `BasemapStyleLanguage` is set to `local` which displays all labels in their corresponding local language. This can be changed to `global`, which displays all labels in English. The `specific` option sets all labels to a selected language and overrides the `BasemapStyleLanguage` settings.
13+
This sample showcases the workflow of configuring basemap style parameters by displaying a basemap with labels in different languages and launches with a `Viewpoint` near Bulgaria, Greece, and Turkey, as they use three different alphabets: Cyrillic, Greek, and Latin, respectively. By default, the `BasemapStyleLanguage` is set to `local`, which displays all labels in their corresponding local language. This can be changed to `global`, which displays all labels in English. The `specific` option sets all labels to a selected language and overrides the `BasemapStyleLanguage` settings.
1414

1515
Pan and zoom to navigate the map and see how different labels are displayed in these countries depending on the selected `BasemapStyleLanguage`: all English, all Greek, all Bulgarian, all Turkish, or each their own.
1616

@@ -34,7 +34,11 @@ Pan and zoom to navigate the map and see how different labels are displayed in t
3434

3535
## About the data
3636

37-
The main data for this sample is the basemap style which includes basemaps that support both language localization and global language setting. The supported languages, along with their language code, can be found in the [API's documentation](https://developers.arcgis.com/rest/basemap-styles/#languages).
37+
The main data for this sample is the `BasemapStyle`, which includes basemaps that support both language localization and global language setting. The supported languages, along with their language code, can be found in the [API's documentation](https://developers.arcgis.com/rest/basemap-styles/languages/).
38+
39+
## Additional information
40+
41+
For ArcGIS Basemap styles, language localization becomes visible when you zoom in closer.
3842

3943
## Tags
4044

11.6 KB
Loading

0 commit comments

Comments
 (0)