-
Notifications
You must be signed in to change notification settings - Fork 39
Add dynamic entity layer #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
af90030
working app
prupani-7 ee5934a
refactoring, readme, readme metadata, png
prupani-7 3585e05
style checker
prupani-7 a5aa93f
style checker
prupani-7 38010c3
comments
prupani-7 543dcea
string.xml
prupani-7 27b7aab
Update add-dynamic-entity-layer/src/main/res/values/strings.xml
prupani-7 2f89be0
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 bbf354f
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 dceea7a
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 4589813
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 97eb9f6
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 e8f303d
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 8629755
Update add-dynamic-entity-layer/src/main/java/com/esri/arcgismaps/sam…
prupani-7 1680058
PR feedback from Shubham
prupani-7 d2d99b7
suggestions
prupani-7 51fec79
metadata
prupani-7 c255d57
handle observationsPerTrack changes
prupani-7 3a845c1
update readme
prupani-7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Add dynamic entity layer | ||
|
||
Display data from an ArcGIS stream service using a dynamic entity layer. | ||
|
||
 | ||
|
||
## Use case | ||
|
||
A stream service is a type of service provided by ArcGIS Velocity and GeoEvent Server that allows clients to receive a stream of data observations via a web socket. ArcGIS Maps SDK for .NET allows you to connect to a stream service and manage the information as dynamic entities and display them in a dynamic entity layer. Displaying information from feeds such as a stream service is important in applications like dashboards where users need to visualize and track updates of real-world objects in real-time. | ||
|
||
Use `ArcGISStreamService` to manage the connection to the stream service and purge options to manage how much data is stored and maintained by the application. The dynamic entity layer will display the latest received observation, and you can set track display properties to determine how to display historical information for each dynamic entity. This includes the number of previous observations to show, whether to display track lines in-between previous observations, and setting renderers. | ||
|
||
## How to use the sample | ||
|
||
Use the controls to connect to or disconnect from the stream service, modify display properties in the dynamic entity layer, and purge all observations from the application. | ||
|
||
## How it works | ||
|
||
1. Create an `ArcGIStreamService` using a `Uri`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Kotlin we just take Url string. This seems to be dotnet specific |
||
2. Set a `DynamicEntityFilter` on the stream service to limit the amount of data coming from the server. | ||
3. Set the `MaximumDuration` property of the stream service `PurgeOptions` to limit the amount of data managed by the application. | ||
4. Create a `DynamicEntityLayer` using the stream service. | ||
5. Update values in the layer's `TrackDisplayProperties` to customize the layer's appearance. | ||
6. Add the `DynamicEntityLayer` to the map. | ||
|
||
## Relevant API | ||
|
||
* ArcGISStreamService | ||
* DynamicEntity | ||
* DynamicEntityFilter | ||
* DynamicEntityLayer | ||
* DynamicEntityPurgeOptions | ||
* TrackDisplayProperties | ||
|
||
## About the data | ||
|
||
This sample uses a [stream service](https://realtimegis2016.esri.com:6443/arcgis/rest/services/SandyVehicles/StreamServer) that simulates live data coming from snowplows near Sandy, Utah. There are multiple vehicle types and multiple agencies operating the snowplows. | ||
|
||
## Additional information | ||
|
||
More information about dynamic entities can be found in the [guide documentation](https://developers.arcgis.com/net/real-time/work-with-dynamic-entities/). | ||
|
||
## Tags | ||
|
||
data, dynamic, entity, live, purge, real-time, service, stream, track |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"category": "Layers", | ||
"description": "Display data from an ArcGIS stream service using a dynamic entity layer.", | ||
"formal_name": "AddDynamicEntityLayer", | ||
"ignore": false, | ||
"images": [ | ||
"add-dynamic-entity-layer.png" | ||
], | ||
"keywords": [ | ||
"data", | ||
"dynamic", | ||
"entity", | ||
"live", | ||
"purge", | ||
"real-time", | ||
"service", | ||
"stream", | ||
"track", | ||
"ArcGISStreamService", | ||
"DynamicEntity", | ||
"DynamicEntityFilter", | ||
"DynamicEntityLayer", | ||
"DynamicEntityPurgeOptions", | ||
"TrackDisplayProperties" | ||
], | ||
"language": "kotlin", | ||
"redirect_from": "", | ||
"relevant_apis": [ | ||
"ArcGISStreamService", | ||
"DynamicEntity", | ||
"DynamicEntityFilter", | ||
"DynamicEntityLayer", | ||
"DynamicEntityPurgeOptions", | ||
"TrackDisplayProperties" | ||
], | ||
"snippets": [ | ||
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/MainActivity.kt", | ||
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/components/BottomSheetContent.kt", | ||
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/components/ComposeMapView.kt", | ||
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/components/MapViewModel.kt", | ||
"src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/screens/MainScreen.kt" | ||
], | ||
"title": "Add dynamic entity layer" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'org.jetbrains.kotlin.android' | ||
|
||
android { | ||
compileSdkVersion rootProject.ext.compileSdkVersion | ||
|
||
defaultConfig { | ||
applicationId "com.esri.arcgismaps.sample.adddynamicentitylayer" | ||
minSdkVersion rootProject.ext.minSdkVersion | ||
targetSdkVersion rootProject.ext.targetSdkVersion | ||
versionCode rootProject.ext.versionCode | ||
versionName rootProject.ext.versionName | ||
buildConfigField("String", "API_KEY", API_KEY) | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
|
||
buildFeatures { | ||
compose = true | ||
buildConfig = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = "$kotlinCompilerExt" | ||
} | ||
|
||
namespace 'com.esri.arcgismaps.sample.adddynamicentitylayer' | ||
} | ||
|
||
dependencies { | ||
// lib dependencies from rootProject build.gradle | ||
implementation "androidx.core:core-ktx:$ktxAndroidCore" | ||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$ktxLifecycle" | ||
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$ktxLifecycle" | ||
implementation "androidx.activity:activity-compose:$composeActivityVersion" | ||
// Jetpack Compose Bill of Materials | ||
implementation platform("androidx.compose:compose-bom:$composeBOM") | ||
// Jetpack Compose dependencies | ||
implementation "androidx.compose.ui:ui" | ||
implementation "androidx.compose.material3:material3" | ||
implementation "androidx.compose.ui:ui-tooling" | ||
implementation "androidx.compose.ui:ui-tooling-preview" | ||
implementation project(path: ':samples-lib') | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:exported="true" | ||
android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
55 changes: 55 additions & 0 deletions
55
...tity-layer/src/main/java/com/esri/arcgismaps/sample/adddynamicentitylayer/MainActivity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* Copyright 2023 Esri | ||
* | ||
* 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.esri.arcgismaps.sample.adddynamicentitylayer | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.runtime.Composable | ||
import com.arcgismaps.ApiKey | ||
import com.arcgismaps.ArcGISEnvironment | ||
import com.esri.arcgismaps.sample.sampleslib.theme.SampleAppTheme | ||
import com.esri.arcgismaps.sample.adddynamicentitylayer.screens.MainScreen | ||
|
||
class MainActivity : ComponentActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// authentication with an API key or named user is | ||
// required to access basemaps and other location services | ||
ArcGISEnvironment.apiKey = ApiKey.create(BuildConfig.API_KEY) | ||
setContent { | ||
SampleAppTheme { | ||
AddDynamicEntityLayerApp() | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun AddDynamicEntityLayerApp() { | ||
Surface( | ||
color = MaterialTheme.colorScheme.background | ||
) { | ||
MainScreen( | ||
sampleName = getString(R.string.app_name), | ||
application = application | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.