You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-maps/create-data-source-android-sdk.md
+28-13Lines changed: 28 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,7 +303,7 @@ map.sources.add(source)
303
303
304
304
::: zone-end
305
305
306
-
The `importDataFromUrl` method provides an easy way to load a GeoJSON feed into a data source but provides limited control on how the data is loaded and what happens after it's been loaded. The following code is a reusable class for importing data from the web or assets folder and returning it to the UI thread via a callback function. Next, add additional post load logic in the callback to process the data, add it to the map, calculate its bounding box, and update the maps camera.
306
+
The `importDataFromUrl` method provides an easy way to load a GeoJSON feed into a data source but provides limited control on how the data is loaded and what happens after it's been loaded. The following code is a reusable class for importing data from the web or assets folder and returning it to the UI thread via a callback function. Next, add more post load logic in the callback to process the data, add it to the map, calculate its bounding box, and update the maps camera.
307
307
308
308
::: zone pivot="programming-language-java-android"
309
309
@@ -767,12 +767,12 @@ A vector tile source describes how to access a vector tile layer. Use the `Vecto
767
767
- Changing the style of the data in the vector maps doesn't require downloading the data again, since the new style can be applied on the client. In contrast, changing the style of a raster tile layer typically requires loading tiles from the server then applying the new style.
768
768
- Since the data is delivered in vector form, there's less server-side processing required to prepare the data. As a result, the newer data can be made available faster.
769
769
770
-
Azure Maps adheres to the [Mapbox Vector Tile Specification](https://github.com/mapbox/vector-tile-spec), an open standard. Azure Maps provides the following vector tiles services as part of the platform:
770
+
Azure Maps adheres to the [Mapbox Vector Tile Specification], an open standard. Azure Maps provides the following vector tiles services as part of the platform:
- Azure Maps Creator also allows custom vector tiles to be created and accessed through the [Render V2-Get Map Tile API](/rest/api/maps/render-v2/get-map-tile)
772
+
-[Road tiles]
773
+
-[Traffic incidents]
774
+
-[Traffic flow]
775
+
- Azure Maps Creator also allows custom vector tiles to be created and accessed through the [Render V2-Get Map Tile API]
776
776
777
777
> [!TIP]
778
778
> When using vector or raster image tiles from the Azure Maps render service with the web SDK, you can replace `atlas.microsoft.com` with the placeholder `azmapsdomain.invalid`. This placeholder will be replaced with the same domain used by the map and will automatically append the same authentication details as well. This greatly simplifies authentication with the render service when using Azure Active Directory authentication.
Data is rendered on the map using rendering layers. A single data source can be referenced by one or more rendering layers. The following rendering layers require a data source:
874
+
Data is rendered on the map using rendering layers. One or more rendering layers can reference a single data source. The following rendering layers require a data source:
875
875
876
-
-[Bubble layer](map-add-bubble-layer-android.md) - renders point data as scaled circles on the map.
877
-
-[Symbol layer](how-to-add-symbol-to-android-map.md)- renders point data as icons or text.
878
-
-[Heat map layer](map-add-heat-map-layer-android.md) - renders point data as a density heat map.
879
-
-[Line layer](android-map-add-line-layer.md) - render a line and or render the outline of polygons.
880
-
-[Polygon layer](how-to-add-shapes-to-android-map.md) - fills the area of a polygon with a solid color or image pattern.
876
+
-[Bubble layer] - renders point data as scaled circles on the map.
877
+
-[Symbol layer]- renders point data as icons or text.
878
+
-[Heat map layer] - renders point data as a density heat map.
879
+
-[Line layer] - render a line and or render the outline of polygons.
880
+
-[Polygon layer] - fills the area of a polygon with a solid color or image pattern.
881
881
882
882
The following code shows how to create a data source, add it to the map, and connect it to a bubble layer. And then, import GeoJSON point data from a remote location into the data source.
883
883
@@ -917,7 +917,7 @@ map.sources.add(source)
917
917
918
918
There are more rendering layers that don't connect to these data sources, but they directly load the data for rendering.
919
919
920
-
-[Tile layer](how-to-add-tile-layer-android-map.md) - superimposes a raster tile layer on top of the map.
920
+
-[Tile layer] - superimposes a raster tile layer on top of the map.
921
921
922
922
## One data source with multiple layers
923
923
@@ -1035,3 +1035,18 @@ See the following articles for more code samples to add to your maps:
Alternatively the properties can be loaded into a dictionary (JSON) first then passed into the feature when creating it, as shown below.
50
+
Alternatively the properties can be loaded into a dictionary (JSON) first then passed into the feature when creating it, as the following code demonstrates:
51
51
52
52
```swift
53
53
//Create a dictionary to store properties for the feature.
@@ -108,7 +108,7 @@ let featureCollection = FeatureCollection(features)
108
108
109
109
### Serialize and deserialize GeoJSON
110
110
111
-
The feature collection, feature, and geometry classes all have `fromJson(_:)` and `toJson()` static methods, which help with serialization. The formatted valid JSON String passed through the `fromJson()` method will create the geometry object. This `fromJson()` method also means you can use `JSONSerialization` or other serialization/deserialization strategies. The following code shows how to take a stringified GeoJSON feature and deserialize it into the `Feature` class, then serialize it back into a GeoJSON string.
111
+
The feature collection, feature, and geometry classes all have `fromJson(_:)` and `toJson()` static methods, which help with serialization. The formatted valid JSON String passed through the `fromJson()` method creates the geometry object. This `fromJson()` method also means you can use `JSONSerialization` or other serialization/deserialization strategies. The following code shows how to take a stringified GeoJSON feature and deserialize it into the `Feature` class, then serialize it back into a GeoJSON string.
112
112
113
113
```swift
114
114
// Take a stringified GeoJSON object.
@@ -138,7 +138,7 @@ let featureString = feature.toJson()
138
138
139
139
Most GeoJSON files contain a `FeatureCollection`. Read GeoJSON files as strings and use the `FeatureCollection.fromJson(_:)` method to deserialize it.
140
140
141
-
The `DataSource` class has a builtin method called `importData(fromURL:)` that can load in GeoJSON files using a URL to a file on the web or the device.
141
+
The `DataSource` class has a built-in method called `importData(fromURL:)` that can load in GeoJSON files using a URL to a file on the web or the device.
The `importData(fromURL:)` method provides an easily way to load a GeoJSON feed into a data source but provides limited control on how the data is loaded and what happens after its been loaded. The following code is a reusable class for importing data from the web or assets folder and returning it to the UI thread via a callback function. In the callback you can then add additional post load logic to process the data, add it to the map, calculate its bounding box, and update the maps camera.
159
+
The `importData(fromURL:)` method provides a way to load a GeoJSON feed into a data source but provides limited control on how the data is loaded and what happens after it's been loaded. The following code is a reusable class for importing data from the web or assets folder and returning it to the UI thread via a callback function. In the callback, you can then add more post load logic to process the data, add it to the map, calculate its bounding box, and update the maps camera.
160
160
161
161
```swift
162
162
importFoundation
@@ -182,7 +182,7 @@ public class Utils: NSObject {
182
182
}
183
183
```
184
184
185
-
The code below shows how to use this utility to import GeoJSON data as a string and return it to the main thread via a callback. In the callback, the string data can be serialized into a GeoJSON Feature collection and added to the data source. Optionally, update the maps camera to focus in on the data.
185
+
The following code shows how to use this utility to import GeoJSON data as a string and return it to the main thread via a callback. In the callback, the string data can be serialized into a GeoJSON Feature collection and added to the data source. Optionally, update the maps camera to focus in on the data.
186
186
187
187
```swift
188
188
// Create a data source and add it to the map.
@@ -229,7 +229,7 @@ Utils.importData(fromURL: url) { result in
229
229
230
230
### Update a feature
231
231
232
-
The `DataSource` class makes its easy to add and remove features. Updating the geometry or properties of a feature requires replacing the feature in the data source. There are two methods that can be used to update a feature(s):
232
+
The `DataSource` class makes it easy to add and remove features. Updating the geometry or properties of a feature requires replacing the feature in the data source. There are two methods that can be used to update a feature(s):
233
233
234
234
1. Create the new feature(s) with the desired updates and replace all features in the data source using the `set` method. This method works well when you want to update all features in a data source.
235
235
@@ -307,12 +307,12 @@ A vector tile source describes how to access a vector tile layer. Use the `Vecto
307
307
- Changing the style of the data in the vector maps doesn't require downloading the data again, since the new style can be applied on the client. In contrast, changing the style of a raster tile layer typically requires loading tiles from the server then applying the new style.
308
308
- Since the data is delivered in vector form, there's less server-side processing required to prepare the data. As a result, the newer data can be made available faster.
309
309
310
-
Azure Maps adheres to the [Mapbox Vector Tile Specification](https://github.com/mapbox/vector-tile-spec), an open standard. Azure Maps provides the following vector tiles services as part of the platform:
310
+
Azure Maps adheres to the [Mapbox Vector Tile Specification], an open standard. Azure Maps provides the following vector tiles services as part of the platform:
- Azure Maps Creator also allows custom vector tiles to be created and accessed through the [Render V2-Get Map Tile API](/rest/api/maps/render-v2/get-map-tile)
312
+
-[Road tiles]
313
+
-[Traffic incidents]
314
+
-[Traffic flow]
315
+
- Azure Maps Creator also allows custom vector tiles to be created and accessed through the [Render V2-Get Map Tile API]
316
316
317
317
> [!TIP]
318
318
> When using vector or raster image tiles from the Azure Maps render service with the iOS SDK, you can replace `atlas.microsoft.com` with the `AzureMap`'s property' `domainPlaceholder`. This placeholder will be replaced with the same domain used by the map and will automatically append the same authentication details as well. This greatly simplifies authentication with the render service when using Azure Active Directory authentication.
Data is rendered on the map using rendering layers. A single data source can be referenced by one or more rendering layers. The following rendering layers require a data source:
378
+
Data is rendered on the map using rendering layers. One or more rendering layers can reference a single data source. The following rendering layers require a data source:
379
379
380
-
-[Bubble layer](add-bubble-layer-map-ios.md) - renders point data as scaled circles on the map.
381
-
-[Symbol layer](add-symbol-layer-ios.md)- renders point data as icons or text.
382
-
-[Heat map layer](add-heat-map-layer-ios.md) - renders point data as a density heat map.
383
-
-[Line layer](add-line-layer-map-ios.md) - render a line and or render the outline of polygons.
384
-
-[Polygon layer](add-polygon-layer-map-ios.md) - fills the area of a polygon with a solid color or image pattern.
380
+
-[Bubble layer] - renders point data as scaled circles on the map.
381
+
-[Symbol layer]- renders point data as icons or text.
382
+
-[Heat map layer] - renders point data as a density heat map.
383
+
-[Line layer] - render a line and or render the outline of polygons.
384
+
-[Polygon layer] - fills the area of a polygon with a solid color or image pattern.
385
385
386
386
The following code shows how to create a data source, add it to the map, import GeoJSON point data from a remote location into the data source, and then connect it to a bubble layer.
387
387
@@ -406,9 +406,9 @@ let layer = BubbleLayer(source: source)
406
406
map.layers.addLayer(layer)
407
407
```
408
408
409
-
There are additional rendering layers that don't connect to these data sources, but they directly load the data for rendering.
409
+
There are other rendering layers that don't connect to these data sources, but they directly load the data for rendering.
410
410
411
-
-[Tile layer](add-tile-layer-map-ios.md) - superimposes a raster tile layer on top of the map.
411
+
-[Tile layer] - superimposes a raster tile layer on top of the map.
412
412
413
413
## One data source with multiple layers
414
414
@@ -418,7 +418,7 @@ Multiple layers can be connected to a single data source. There are many differe
418
418
419
419
In most mapping platforms, you would need a polygon object, a line object, and a pin for each position in the polygon. As the polygon is modified, you would need to manually update the line and pins, which can quickly become complex.
420
420
421
-
With Azure Maps, all you need is a single polygon in a data source as shown in the code below.
421
+
With Azure Maps, all you need is a single polygon in a data source as shown in the following code.
0 commit comments