Skip to content

Commit 2b8ddb4

Browse files
authored
Release v200.1.0 (#95)
1 parent ccd500f commit 2b8ddb4

File tree

1,004 files changed

+26002
-610
lines changed

Some content is hidden

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

1,004 files changed

+26002
-610
lines changed

README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,59 @@
11
# ArcGIS Maps SDK Kotlin Samples
22

3-
# Overview
4-
ArcGIS Maps SDK for Kotlin v200.0.0 samples. The `main` branch of this repository contains sample app modules for the latest available version of the [ArcGIS Maps SDK Android Kotlin](https://developers.arcgis.com/kotlin/). Samples released under older versions can be found through the [git tags](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/tags). Please read our [wiki](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/wiki) for help with working with this repository.
3+
## Overview
4+
5+
ArcGIS Maps SDK for Kotlin v200.1.0 samples. The `main` branch of this repository contains sample app modules for the latest available version of the [ArcGIS Maps SDK Android Kotlin](https://developers.arcgis.com/kotlin/). Samples released under older versions can be found through the [git tags](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/tags). Please read our [wiki](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/wiki) for help with working with this repository.
6+
7+
## Prerequisites
58

6-
# Prerequisites
79
* The samples are building with `compileSdkVersion 33`
810
* [Android Studio](http://developer.android.com/sdk/index.html)
911
* [An ArcGIS Developers API key](https://developers.arcgis.com/kotlin/get-started/#3-get-an-api-key)
1012

1113
## Developer Instructions
12-
Please read our [developer instructions wiki page](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/wiki/dev-instructions) to set up your developer environment with Android Studio. Instructions include forking and cloning the repository for those new to Git.
14+
15+
Please read our [developer instructions wiki page](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/wiki/Developer-Instructions) to set up your developer environment with Android Studio. Instructions include forking and cloning the repository for those new to Git.
1316

1417
Once the project is cloned to disk you can import into Android Studio:
1518

1619
* From the Welcome to Android Studio screen, click the **Open** button. (If you're already inside a project, click **File > Open** in the menu bar instead.)
1720
* Navigate to the **arcgis-maps-sdk-kotlin-samples/** folder and click **OK**.
1821

1922
## Accessing Esri location services
23+
2024
Accessing Esri location services, including basemaps, routing, and geocoding, requires authentication using either an API Key or an ArcGIS identity:
21-
1. API key: A permanent key that gives your application access to Esri location services. Visit your [ArcGIS Developers Dashboard](https://developers.arcgis.com/dashboard) to create a new API key or access an existing API key.
22-
23-
The Android samples in this repository have been structured to use an API key, set once, which will run in all samples. Set your API key in the `gradle.properties` file located in the `/.gradle` folder within your home directory (`/Users/<user_name>/.gradle/gradle.properties`). The API_KEY property should contain quotes around the key itself: `API_KEY = "YOUR_API_KEY"`
2425

25-
2. ArcGIS identity: An ArcGIS named user account that is a member of an organization in ArcGIS Online or ArcGIS Enterprise.
26+
### API key
27+
28+
A permanent key that gives your application access to Esri location services. Visit your [ArcGIS Developers Dashboard](https://developers.arcgis.com/dashboard) to create a new API key or access an existing API key.
29+
The Android samples in this repository have been structured to use an API key, set once, which will run in all samples.
30+
Set your API key in the `gradle.properties` file located in the `/.gradle` folder within your home directory.
31+
The API_KEY property should contain quotes around the key itself:
32+
```gradle
33+
API_KEY = "YOUR_API_KEY" // path: /Users/<user_name>/.gradle/gradle.properties
34+
```
35+
36+
### ArcGIS identity
37+
38+
An ArcGIS named user account that is a member of an organization in ArcGIS Online or ArcGIS Enterprise.
2639

2740
## Run a sample
28-
Once you have set up your developer environment you can run any sample from within Android Studio by selecting the app module from the **Edit Configurations** drop down and clicking the **Run** button from the toolbar.
41+
42+
Once you have set up your developer environment you can run any sample from within Android Studio by selecting the app module from the **Edit Configurations** drop down and clicking the **Run** button from the toolbar.
2943

3044
### Build/Run sample from Gradle
45+
3146
You can execute all the build tasks using the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) command line tool. It's available as a batch file for Windows (gradlew.bat) and a shell script for Linux/Mac (gradlew.sh) and it is accessible from the root of the project.
3247

33-
- Build a debug APK
48+
* Build a debug APK
3449

3550
```
3651
$ ./gradlew assembleDebug
3752
```
3853

39-
- Run the app
54+
* Install the app on the device
4055

41-
**Device**
42-
```
56+
```adb
4357
adb -d install path/to/sample.apk
4458
```
4559

@@ -53,8 +67,8 @@ Do you have something to [contribute](.github/CONTRIBUTING.md)? Send a pull requ
5367

5468
Have a problem running one of the samples in this repo? Does the sample not work on a specific device? Have questions about how the code in this repo is working? Want to request a specific sample? In that case, [submit a new issue](https://github.com/Esri/arcgis-maps-sdk-kotlin-samples/issues).
5569

56-
5770
## Contributing
71+
5872
Anyone and everyone is welcome to [contribute](.github/CONTRIBUTING.md). We do accept pull requests.
5973

6074
1. Get Involved
@@ -65,6 +79,7 @@ Anyone and everyone is welcome to [contribute](.github/CONTRIBUTING.md). We do a
6579
Please see our [guidelines for contributing doc](https://github.com/Esri/contributing/blob/master/README.md)
6680

6781
## Licensing
82+
6883
Copyright 2022 Esri
6984

7085
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

add-feature-layers/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
</activity>
2222
<activity
2323
android:name=".MainActivity"
24-
android:exported="true"
25-
android:label="@string/app_name">
24+
android:exported="true">
2625
<intent-filter>
2726
<action android:name="android.intent.action.MAIN" />
2827
</intent-filter>

add-feature-layers/src/main/java/com/esri/arcgismaps/sample/addfeaturelayers/MainActivity.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ import com.arcgismaps.mapping.BasemapStyle
3434
import com.arcgismaps.mapping.Viewpoint
3535
import com.arcgismaps.mapping.layers.FeatureLayer
3636
import com.arcgismaps.portal.Portal
37-
import com.arcgismaps.portal.PortalItem
37+
import com.arcgismaps.mapping.PortalItem
3838
import com.esri.arcgismaps.sample.addfeaturelayers.databinding.ActivityMainBinding
3939
import kotlinx.coroutines.launch
4040
import java.io.File
4141

42-
4342
class MainActivity : AppCompatActivity() {
4443

45-
private val TAG = MainActivity::class.java.simpleName
46-
4744
// set up data binding for the activity
4845
private val activityMainBinding: ActivityMainBinding by lazy {
4946
DataBindingUtil.setContentView(this, R.layout.activity_main)
@@ -102,7 +99,7 @@ class MainActivity : AppCompatActivity() {
10299
val serviceFeatureTable =
103100
ServiceFeatureTable(resources.getString(R.string.sample_service_url))
104101
// create a feature layer with the feature table
105-
val featureLayer = FeatureLayer(serviceFeatureTable)
102+
val featureLayer = FeatureLayer.createWithFeatureTable(serviceFeatureTable)
106103
val viewpoint = Viewpoint(41.70, -88.20, 120000.0)
107104
// set the feature layer on the map
108105
setFeatureLayer(featureLayer, viewpoint)
@@ -119,7 +116,7 @@ class MainActivity : AppCompatActivity() {
119116
val portalItem = PortalItem(portal, "1759fd3e8a324358a0c58d9a687a8578")
120117
portalItem.load().onSuccess {
121118
// create the feature layer with the item
122-
val featureLayer = FeatureLayer(portalItem)
119+
val featureLayer = FeatureLayer.createWithItem(portalItem)
123120
// set the viewpoint to Portland, Oregon
124121
val viewpoint = Viewpoint(45.5266, -122.6219, 2500.0)
125122
// set the feature layer on the map
@@ -147,7 +144,7 @@ class MainActivity : AppCompatActivity() {
147144
return
148145
}
149146
// create a feature layer with the feature table
150-
val featureLayer = FeatureLayer(geodatabaseFeatureTable)
147+
val featureLayer = FeatureLayer.createWithFeatureTable(geodatabaseFeatureTable)
151148
// set the viewpoint to Malibu, California
152149
val viewpoint = Viewpoint(34.0772, -118.7989, 600000.0)
153150
// set the feature layer on the map
@@ -170,7 +167,7 @@ class MainActivity : AppCompatActivity() {
170167
// get the first feature table in the geopackage
171168
val geoPackageFeatureTable = geoPackage.geoPackageFeatureTables.first()
172169
// create a feature layer with the feature table
173-
val featureLayer = FeatureLayer(geoPackageFeatureTable)
170+
val featureLayer = FeatureLayer.createWithFeatureTable(geoPackageFeatureTable)
174171
// set the viewpoint to Denver, CO
175172
val viewpoint = Viewpoint(39.7294, -104.8319, 500000.0)
176173
// set the feature layer on the map
@@ -193,7 +190,7 @@ class MainActivity : AppCompatActivity() {
193190
val shapeFileTable = ShapefileFeatureTable(file.path)
194191
shapeFileTable.load().onSuccess {
195192
// create a feature layer for the shapefile feature table
196-
val featureLayer = FeatureLayer(shapeFileTable)
193+
val featureLayer = FeatureLayer.createWithFeatureTable(shapeFileTable)
197194
// set the viewpoint to Scotland
198195
val viewpoint = Viewpoint(56.641344, -3.889066, 6000000.0)
199196
// set the feature layer on the map
@@ -205,7 +202,7 @@ class MainActivity : AppCompatActivity() {
205202

206203
private fun showError(message: String) {
207204
Toast.makeText(this@MainActivity, message, Toast.LENGTH_SHORT).show()
208-
Log.e(TAG, message)
205+
Log.e(localClassName, message)
209206
}
210207

211208
/**

add-feature-layers/src/main/res/values/colors.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

add-feature-layers/src/main/res/values/styles.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Add features with contingent values
2+
3+
Create and add features whose attribute values satisfy a predefined set of contingencies.
4+
5+
![Add features with contingent values](add-features-with-contingent-values.png)
6+
7+
## Use case
8+
9+
Contingent values are a data design feature that allow you to make values in one field dependent on values in another field. Your choice for a value on one field further constrains the domain values that can be placed on another field. In this way, contingent values enforce data integrity by applying additional constraints to reduce the number of valid field inputs.
10+
11+
For example, a field crew working in a sensitive habitat area may be required to stay a certain distance away from occupied bird nests, but the size of that exclusion area differs depending on the bird's level of protection according to presiding laws. Surveyors can add points of bird nests in the work area and their selection of the size of the exclusion area will be contingent on the values in other attribute fields.
12+
13+
## How to use the sample
14+
15+
Tap on the map to add a feature symbolizing a bird's nest. Then choose values describing the nest's status, protection, and buffer size. Notice how different values are available depending on the values of preceding fields. Once the contingent values are validated, tap "Done" to add the feature to the map.
16+
17+
## How it works
18+
19+
1. Create and load the `Geodatabase` from the mobile geodatabase location on file.
20+
2. Load the first `GeodatabaseFeatureTable`.
21+
3. Load the `ContingentValuesDefinition` from the feature table.
22+
4. Create a new `FeatureLayer` from the feature table and add it to the map.
23+
5. Create a new `ArcGISFeature` using `GeodatabaseFeatureTable.createFeature()`
24+
6. Get the first field by name using `ArcGISFeatureTable.fields.find{ }`.
25+
7. Then get the `Field.domain` as an `CodedValueDomain`.
26+
8. Get the coded value domain's `codedValues` to get an array of `CodedValue`'s.
27+
9. After selecting a value from the initial coded values for the first field, retrieve the remaining valid contingent values for each field as you select the values for the attributes.
28+
i. Get the `ContingentValueResult`s by using `ArcGISFeatureTable.getContingentValues(ArcGISFeature, "field_name")` with the feature and the target field by name.
29+
ii. Get an array of valid `ContingentValues` from `ContingentValuesResult.contingentValuesByFieldGroup` dictionary with the name of the relevant field group.
30+
iii. Iterate through the array of valid contingent values to create an array of `ContingentCodedValue` names or the minimum and maximum values of a `ContingentRangeValue` depending on the type of `ContingentValue` returned.
31+
10. Validate the feature's contingent values by using `validateContingencyConstraints(feature)` with the current feature. If the resulting array is empty, the selected values are valid.
32+
33+
## Relevant API
34+
35+
* ArcGISFeatureTable
36+
* CodedValue
37+
* CodedValueDomain
38+
* ContingencyConstraintViolation
39+
* ContingentCodedValue
40+
* ContingentRangeValue
41+
* ContingentValuesDefinition
42+
* ContingentValuesResult
43+
44+
## About the data
45+
46+
This sample uses the [Contingent values birds nests](https://arcgis.com/home/item.html?id=e12b54ea799f4606a2712157cf9f6e41) mobile geodatabase and the [Fillmore topographic map](https://arcgis.com/home/item.html?id=b5106355f1634b8996e634c04b6a930a) vector tile package for the basemap.
47+
The mobile geodatabase contains birds nests in the Fillmore area, defined with contingent values. Each feature contains information about its status, protection, and buffer size.
48+
49+
## Additional information
50+
51+
Learn more about contingent values and how to utilize them on the [ArcGIS Pro documentation](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/contingent-values.htm).
52+
53+
## Tags
54+
55+
coded values, contingent values, feature table, geodatabase
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"category": "Edit and Manage Data",
3+
"description": "Create and add features whose attribute values satisfy a predefined set of contingencies.",
4+
"formal_name": "AddFeaturesWithContingentValues",
5+
"ignore": false,
6+
"images": [
7+
"add-features-with-contingent-values.png"
8+
],
9+
"keywords": [
10+
"coded values",
11+
"contingent values",
12+
"feature table",
13+
"geodatabase",
14+
"ArcGISFeatureTable",
15+
"CodedValue",
16+
"CodedValueDomain",
17+
"ContingencyConstraintViolation",
18+
"ContingentCodedValue",
19+
"ContingentRangeValue",
20+
"ContingentValuesDefinition",
21+
"ContingentValuesResult"
22+
],
23+
"language": "kotlin",
24+
"redirect_from": [
25+
"/android/latest/sample-code/add-features-with-contingent-values.htm"
26+
],
27+
"relevant_apis": [
28+
"ArcGISFeatureTable",
29+
"CodedValue",
30+
"CodedValueDomain",
31+
"ContingencyConstraintViolation",
32+
"ContingentCodedValue",
33+
"ContingentRangeValue",
34+
"ContingentValuesDefinition",
35+
"ContingentValuesResult"
36+
],
37+
"snippets": [
38+
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/MainActivity.kt",
39+
"src/main/java/com/esri/arcgismaps/sample/addfeatureswithcontingentvalues/DownloadActivity.kt"
40+
],
41+
"title": "Add features with contingent values"
42+
}
376 KB
Loading
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'org.jetbrains.kotlin.android'
3+
4+
android {
5+
compileSdkVersion rootProject.ext.compileSdkVersion
6+
7+
defaultConfig {
8+
applicationId "com.esri.arcgismaps.sample.addfeatureswithcontingentvalues"
9+
minSdkVersion rootProject.ext.minSdkVersion
10+
targetSdkVersion rootProject.ext.targetSdkVersion
11+
versionCode rootProject.ext.versionCode
12+
versionName rootProject.ext.versionName
13+
buildConfigField("String", "API_KEY", API_KEY)
14+
}
15+
16+
buildTypes {
17+
release {
18+
minifyEnabled false
19+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20+
}
21+
}
22+
23+
buildFeatures {
24+
dataBinding true
25+
}
26+
27+
namespace 'com.esri.arcgismaps.sample.addfeatureswithcontingentvalues'
28+
}
29+
30+
dependencies {
31+
// lib dependencies from rootProject build.gradle
32+
implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
33+
implementation "com.google.android.material:material:$materialVersion"
34+
implementation project(path: ':samples-lib')
35+
implementation 'androidx.appcompat:appcompat:1.5.1'
36+
}

0 commit comments

Comments
 (0)