Skip to content

Commit 3635291

Browse files
authored
Merge pull request #112744 from stevemunk/tutorial-load-geojson-file-android
Minor grammatical changes and end links in Tutorial: Load GeoJSON data into Azure Maps Android SDK
2 parents 64f9f82 + ffd776a commit 3635291

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

articles/azure-maps/tutorial-load-geojson-file-android.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: 'Tutorial: Load GeoJSON data into Azure Maps Android SDK | Microsoft Azure Maps'
2+
title: 'Tutorial: Load GeoJSON data into Azure Maps Android SDK'
3+
titleSuffix: Microsoft Azure Maps
34
description: Tutorial on how to load GeoJSON data file into the Azure Maps Android map SDK.
45
author: dubiety
56
ms.author: yuchungchen
@@ -16,29 +17,30 @@ zone_pivot_groups: azure-maps-android
1617
This tutorial guides you through the process of importing a GeoJSON file of location data into the Azure Maps Android SDK. In this tutorial, you learn how to:
1718

1819
> [!div class="checklist"]
20+
>
1921
> * Add Azure Maps to an Android application.
2022
> * Create a data source and load in a GeoJSON file from a local file or the web.
2123
> * Display the data on the map.
2224
> * Interact with the data on the maps to view its details.
2325
2426
## Prerequisites
2527

26-
1. Complete the [Quickstart: Create an Android app](quick-android-map.md). This tutorial extends the code used in that quickstart.
27-
2. Download the [Sample Points of Interest](https://github.com/Azure-Samples/AzureMapsCodeSamples/blob/master/Static/data/geojson/SamplePoiDataSet.json) GeoJSON file.
28+
1. Complete the [Quickstart: Create an Android app]. This tutorial extends the code used in that quickstart.
29+
2. Download the [Sample Points of Interest] GeoJSON file.
2830

2931
### Import GeoJSON data from web or assets folder
3032

3133
Most GeoJSON files wrap all data within a `FeatureCollection`. With this scenario in mind, if the GeoJSON files are loaded into the application as a string, they can be passed into the feature collection's static `fromJson` method, which deserializes the string into a GeoJSON `FeatureCollection` object that can be added to the map.
3234

3335
The following steps show you how to import a GeoJSON file into the application and deserialize it as a GeoJSON `FeatureCollection` object.
3436

35-
1. Complete the [Quickstart: Create an Android app](quick-android-map.md) as the following steps build on top of this application.
37+
1. Complete the [Quickstart: Create an Android app] as the following steps build on top of this application.
3638
2. In the project panel of Android studio, right-click on the **app** folder and go to `New > Folder > Assets Folder`.
37-
3. Drag and drop the [Sample Points of Interest](https://github.com/Azure-Samples/AzureMapsCodeSamples/blob/master/Static/data/geojson/SamplePoiDataSet.json) GeoJSON file into the assets folder.
39+
3. Drag and drop the [Sample Points of Interest] GeoJSON file into the assets folder.
3840

3941
::: zone pivot="programming-language-java-android"
4042

41-
4. Go into the **MainActivity.java** file and add the following code inside the callback for the `mapControl.onReady` event, inside the `onCreate` method. This code loads the **SamplePoiDataSet.json** file from the assets folder into a data source using `importDataFromUrl` method and then adds it to the map.
43+
4. Go into the _MainActivity.java_ file and add the following code inside the callback for the `mapControl.onReady` event, inside the `onCreate` method. This code loads the _SamplePoiDataSet.json_ file from the assets folder into a data source using `importDataFromUrl` method and then adds it to the map.
4244

4345
```java
4446
//Create a data source and add it to the map.
@@ -55,7 +57,7 @@ map.sources.add(source);
5557

5658
::: zone pivot="programming-language-kotlin"
5759

58-
4. Go into the **MainActivity.kt** file and add the following code inside the callback for the `mapControl.onReady` event, inside the `onCreate` method. This code loads the **SamplePoiDataSet.json** file from the assets folder into a data source using `importDataFromUrl` method and then adds it to the map.
60+
4. Go into the _MainActivity.kt_ file and add the following code inside the callback for the `mapControl.onReady` event, inside the `onCreate` method. This code loads the _SamplePoiDataSet.json_ file from the assets folder into a data source using `importDataFromUrl` method and then adds it to the map.
5961

6062
```kotlin
6163
//Create a data source and add it to the map.
@@ -70,7 +72,7 @@ map.sources.add(source);
7072

7173
::: zone-end
7274

73-
5. Using the code to load the GeoJSON data a data source, we now need to specify how that data should be displayed on the map. There are several different rendering layers for point data; [Bubble layer](map-add-bubble-layer-android.md), [Symbol layer](how-to-add-symbol-to-android-map.md), and [Heat map layer](map-add-heat-map-layer-android.md) are the most commonly used layers. Add the following code to render the data in a bubble layer in the callback for the `mapControl.onReady` event after the code for importing the data.
75+
5. Using the code to load the GeoJSON data a data source, we now need to specify how that data should be displayed on the map. There are several different rendering layers for point data; [Bubble layer], [Symbol layer], and [Heat map layer] are the most commonly used layers. Add the following code to render the data in a bubble layer in the callback for the `mapControl.onReady` event after the code for importing the data.
7476

7577
::: zone pivot="programming-language-java-android"
7678

@@ -92,8 +94,8 @@ map.layers.add(layer)
9294

9395
::: zone-end
9496

95-
6. In the project panel of Android studio, right-click on the **layout** folder under the path `app > res > layout` and go to `New > File`. Create a new file called **popup_text.xml**.
96-
7. Open the **popup_text.xml** file. If the file opens in a designer view, right-click on the screen and select "Go to XML". Copy and paste the following XML into this file. This XML creates a simple layout that can be used with a popup and contains a text view.
97+
6. In the project panel of Android studio, right-click on the **layout** folder under the path `app > res > layout` and go to `New > File`. Create a new file called _popup_text.xml_.
98+
7. Open the _popup_text.xml_ file. If the file opens in a designer view, right-click on the screen and select **Go to XML**. Copy and paste the following XML into this file. This XML creates a simple layout that can be used with a popup and contains a text view.
9799

98100
```xml
99101
<?xml version="1.0" encoding="utf-8"?>
@@ -120,7 +122,7 @@ map.layers.add(layer)
120122

121123
::: zone pivot="programming-language-java-android"
122124

123-
8. Go back into the **MainActivity.java** file and after the code for the bubble layer, add the following code to create a reusable popup.
125+
8. Go back into the _MainActivity.java_ file and after the code for the bubble layer, add the following code to create a reusable popup.
124126

125127
```java
126128
//Create a popup and add it to the map.
@@ -135,7 +137,7 @@ popup.close();
135137

136138
::: zone pivot="programming-language-kotlin"
137139

138-
8. Go back into the **MainActivity.kt** file and after the code for the bubble layer, add the following code to create a reusable popup.
140+
8. Go back into the _MainActivity.kt_ file and after the code for the bubble layer, add the following code to create a reusable popup.
139141

140142
```kotlin
141143
//Create a popup and add it to the map.
@@ -148,7 +150,7 @@ popup.close()
148150

149151
::: zone-end
150152

151-
9. Add the following code to attach a click event to the bubble layer. When a bubble in the bubble layer is tapped, the event will fire and retrieve some details from the properties of the selected feature, create a view using the **popup_text.xml** layout file, pass it in as content into the popup, then show the popup at the features position.
153+
9. Add the following code to attach a `click` event to the bubble layer. When a bubble in the bubble layer is tapped, the event fires and retrieves details from the properties of the selected feature, create a view using the _popup_text.xml_ layout file, pass it in as content into the popup, then show the popup at the features position.
152154

153155
::: zone pivot="programming-language-java-android"
154156

@@ -250,16 +252,27 @@ Take the following steps to clean up the resources from this tutorial:
250252
To see more code examples and an interactive coding experience:
251253

252254
> [!div class="nextstepaction"]
253-
> [Use data-driven style expressions](data-driven-style-expressions-android-sdk.md)
255+
> [Use data-driven style expressions]
254256
255257
> [!div class="nextstepaction"]
256-
> [Display feature information](display-feature-information-android.md)
258+
> [Display feature information]
257259
258260
> [!div class="nextstepaction"]
259-
> [Add a symbol layer](how-to-add-symbol-to-android-map.md)
261+
> [Add a symbol layer]
260262
261263
> [!div class="nextstepaction"]
262-
> [Add a line layer](android-map-add-line-layer.md)
264+
> [Add a line layer]
263265
264266
> [!div class="nextstepaction"]
265-
> [Add a polygon layer](how-to-add-shapes-to-android-map.md)
267+
> [Add a polygon layer]
268+
269+
[Add a line layer]: android-map-add-line-layer.md
270+
[Add a polygon layer]: how-to-add-shapes-to-android-map.md
271+
[Add a symbol layer]: how-to-add-symbol-to-android-map.md
272+
[Bubble layer]: map-add-bubble-layer-android.md
273+
[Display feature information]: display-feature-information-android.md
274+
[Heat map layer]: map-add-heat-map-layer-android.md
275+
[Quickstart: Create an Android app]: quick-android-map.md
276+
[Sample Points of Interest]: https://github.com/Azure-Samples/AzureMapsCodeSamples/blob/master/Static/data/geojson/SamplePoiDataSet.json
277+
[Symbol layer]: how-to-add-symbol-to-android-map.md
278+
[Use data-driven style expressions]: data-driven-style-expressions-android-sdk.md

0 commit comments

Comments
 (0)