-
Notifications
You must be signed in to change notification settings - Fork 124
Tschie/preplanned map #405
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 57 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
87664fd
download preplanned map sample
JonLavi 348e199
refactoring
JonLavi 6be1fd7
add ref to update parameters
JonLavi 99beb85
method/enum name for update option
JonLavi e8ec679
method/enum name for update option
JonLavi bde5514
syntax
JonLavi 7faeaa0
update runtime version, imports
JonLavi 1e84a01
inner class to private
JonLavi c46cd60
add auth manager to handle OAuth challenge
JonLavi 0df9efa
rebase to split dev branch
JonLavi 3981033
mark portal as requires authentication
JonLavi 1fca445
update README.md
JonLavi 2ca56ec
add screenshot alt text
JonLavi b6d8093
update README.md
JonLavi b86a26e
update README.md
JonLavi f95a334
Merge branch 'download-preplanned-map-100-6' of github.com:Esri/arcgi…
JonLavi f36f1ae
update README.md for scheduled updates workflow
JonLavi 3563dd7
update link to guide
JonLavi 6e39b46
update README.md
JonLavi ef763a8
update use case
JonLavi fcfd895
improve 'how it works'
JonLavi 8133e81
add preview of area of interest
JonLavi 715a8db
improve drawing area of interest
JonLavi b6a3668
update use case wording, references in additional information
JonLavi e870890
fix deleting temp files, add button 'return to web map'
JonLavi c38d6e6
add numbering to list view
JonLavi db1a61f
zoom to area on select, refactoring
JonLavi af91b9e
update listener adding/removing
JonLavi 894e6da
refactoring
JonLavi 143919f
disable/enable showWebMapButton approprately
JonLavi d0dd8a3
add README.metadata.json
JonLavi 00ecc61
fix function naming
JonLavi ede10fc
add confirmation popup when deleting
JonLavi 0a18d9e
refactoring, use commons library to delete
JonLavi 98cf949
fix commons-io dependency
JonLavi f211e0e
'show web map' button width
JonLavi 5e2d63e
reorder imports
JonLavi cfb1396
improve viewpoint change, button updates
JonLavi 4e36b22
smaller UI
JonLavi 476920c
refactoring and comments
JonLavi 1c4d497
javadoc comments and formatting
JonLavi 58b1fa1
remove stray q file
JonLavi c603abc
address review corrections
JonLavi a5285fd
review changes and refactoring
JonLavi dd82287
refactoring
JonLavi 23a9759
whitespace
JonLavi 3dc75bb
web map -> online map
JonLavi 3a26be6
further information -> additional information
JonLavi 17d9e01
mmpk to class member
JonLavi eaf0920
change button text
JonLavi 74320f1
selecting view online map pans to selected area
JonLavi 7c3e233
formatting
JonLavi a741ce9
update README.md
JonLavi a1f5fff
copyright statements
JonLavi aa31ee7
remove commented code
JonLavi 69fed73
try to simplify a bit
tschie ab29115
simplify sample
tschie 1fca844
don't hide graphics overlay on download
tschie 6994505
add snippet
tschie 0e93886
update How to use the sample section
tschie 2a98d9d
Update DownloadPreplannedMap.png
tschie 98faa95
Slim up the use case
tschie 6ca9bbc
remove fxml comments
tschie 61f194b
remove redirect from for new sample
tschie 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
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,52 @@ | ||
# Download a preplanned map area | ||
|
||
Take a map offline using a preplanned map area. | ||
|
||
 | ||
|
||
## Use case | ||
|
||
When using the preplanned workflow, the author of the web map can set up offline packages for a map area ahead of time, which can then be distributed to end-users to view on their devices. Because the resources for the area are packaged once and can be downloaded many times by different users, this approach is faster and more scalable for large organizations when compared to an on-demand workflow (where each end-user requests a specific area that is then generated and delivered by a service). For example, this workflow could be used by survey workers operating in remote areas where network connectivity is not available. The workers could download preplanned mobile areas to their individual devices ahead of time and perform their work normally while disconnected. | ||
|
||
## How to use the sample | ||
|
||
**NOTE:** Downloading Tiles for offline use requires authentication with the web map's server. To use this sample, you will require an [ArcGIS Online](www.arcgis.com) account. | ||
|
||
Select a map area, then click "Download Preplanned Area" to take it offline. When viewing a downloaded map area, click 'Show Online Map' to return to the online map. Click "Delete All Downloaded Areas" to remove any downloaded map areas. | ||
|
||
## How it works | ||
|
||
1. Open the `Map` from a `PortalItem` and display it. | ||
2. Create an `OfflineMapTask` from the portal item. | ||
3. Get the `PreplannedMapArea`s from the task, and then load them. | ||
4. To download a selected map area, create the default `DownloadPreplannedOfflineMapParameters` from the task using the selected preplanned map area. | ||
5. Set the update mode of the preplanned map area. | ||
6. Use the parameters and a download path to create a `DownloadPreplannedOfflineMapJob` from the task. | ||
7. Start the job. Once it has completed, get the `DownloadPreplannedOfflineMapResult`. | ||
8. Get the `Map` from the result and display it in the `MapView`. | ||
|
||
## Relevant API | ||
|
||
* DownloadPreplannedOfflineMapJob | ||
* DownloadPreplannedOfflineMapParameters | ||
* DownloadPreplannedOfflineMapResult | ||
* OfflineMapTask | ||
* PreplannedMapArea | ||
|
||
## About the data | ||
|
||
The [Naperville stormwater network map](https://arcgisruntime.maps.arcgis.com/home/item.html?id=acc027394bc84c2fb04d1ed317aac674) is based on ArcGIS Solutions for Stormwater and provides a realistic depiction of a theoretical stormwater network. | ||
|
||
## Additional information | ||
|
||
`PreplannedUpdateMode` can be used to set the way the preplanned map area receives updates in several ways: | ||
|
||
* `NO_UPDATES` - No updates will be performed. | ||
* `SYNC_WITH_FEATURE_SERVICES` - Changes, including local edits, will be synced directly with the underlying feature services. | ||
* `DOWNLOAD_SCHEDULED_UPDATES` - Scheduled, read-only updates will be downloaded from the online map area and applied to the local mobile geodatabases. | ||
|
||
See [Take a map offline - preplanned](https://developers.arcgis.com/java/latest/guide/take-map-offline-preplanned.htm) to learn about preplanned workflows, including how to define preplanned areas in ArcGIS Online. Alternatively, visit [Take a map offline - on demand](https://developers.arcgis.com/java/latest/guide/take-map-offline-ondemand.htm) or refer to the sample 'Generate Offline Map' to learn about the on-demand workflow and see how the workflows differ. | ||
|
||
## Tags | ||
|
||
map area, offline, preplanned, pre-planned |
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,29 @@ | ||
{ | ||
"category": "Map", | ||
"description": "Take a map offline using a preplanned map area.", | ||
"ignore": false, | ||
"images": [ | ||
"DownloadPreplannedMap.png" | ||
], | ||
"keywords": [ | ||
"map area", | ||
"offline", | ||
"preplanned", | ||
"pre-planned" | ||
], | ||
"redirect_from": "/java/latest/sample-code/download-preplanned-map.htm", | ||
"relevant_apis": [ | ||
"DownloadPreplannedOfflineMapJob", | ||
"DownloadPreplannedOfflineMapParameters", | ||
"DownloadPreplannedOfflineMapResult", | ||
"OfflineMapTask", | ||
"PreplannedMapArea" | ||
], | ||
"snippets": [ | ||
"src/main/java/com/esri/samples/download_preplanned_map/DownloadPreplannedMapController.java", | ||
"src/main/java/com/esri/samples/download_preplanned_map/DownloadPreplannedMapSample.java", | ||
"src/main/java/com/esri/samples/download_preplanned_map/PreplannedMapAreaListCell.java", | ||
"src/main/resources/download_preplanned_map.fxml" | ||
], | ||
"title": "Download a Preplanned Map Area" | ||
} |
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,75 @@ | ||
plugins { | ||
id 'application' | ||
id 'org.openjfx.javafxplugin' version '0.0.5' | ||
} | ||
|
||
group = 'com.esri.samples' | ||
|
||
ext { | ||
arcgisVersion = '100.6.0-2490' | ||
} | ||
|
||
javafx { | ||
version = "11.0.1" | ||
modules = [ 'javafx.controls', 'javafx.fxml' ] | ||
} | ||
|
||
compileJava.options.encoding = 'UTF-8' | ||
|
||
repositories { | ||
jcenter() | ||
maven { | ||
url 'https://esri.bintray.com/arcgis' | ||
} | ||
maven { | ||
url 'http://olympus.esri.com/artifactory/arcgisruntime-repo' | ||
} | ||
} | ||
|
||
configurations { | ||
natives | ||
} | ||
|
||
dependencies { | ||
compile "com.esri.arcgisruntime:arcgis-java:$arcgisVersion" | ||
natives "com.esri.arcgisruntime:arcgis-java-jnilibs:$arcgisVersion" | ||
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion" | ||
compile 'commons-io:commons-io:2.4' | ||
} | ||
|
||
task copyNatives(type: Copy) { | ||
description = "Copies the arcgis native libraries into the project build directory for development." | ||
group = "build" | ||
configurations.natives.asFileTree.each { | ||
from(zipTree(it)) | ||
} | ||
// store native libraries in a common location shared with other samples | ||
into "${System.properties.getProperty("user.home")}/.arcgis/$arcgisVersion" | ||
} | ||
|
||
run { | ||
dependsOn copyNatives | ||
mainClassName = 'com.esri.samples.download_preplanned_map.DownloadPreplannedMapLauncher' | ||
} | ||
|
||
jar { | ||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE | ||
manifest { | ||
attributes("Main-Class": "$mainClassName") | ||
} | ||
from { | ||
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
} | ||
|
||
task productionZip(type: Zip) { | ||
group = 'distribution' | ||
from copyNatives | ||
from jar.destinationDir | ||
into (project.name) | ||
baseName = project.name | ||
} | ||
|
||
wrapper { | ||
gradleVersion = '5.0' | ||
} |
5 changes: 5 additions & 0 deletions
5
map/download-preplanned-map/gradle/wrapper/gradle-wrapper.properties
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,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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,172 @@ | ||
#!/usr/bin/env sh | ||
|
||
############################################################################## | ||
## | ||
## Gradle start up script for UN*X | ||
## | ||
############################################################################## | ||
|
||
# Attempt to set APP_HOME | ||
# Resolve links: $0 may be a link | ||
PRG="$0" | ||
# Need this for relative symlinks. | ||
while [ -h "$PRG" ] ; do | ||
ls=`ls -ld "$PRG"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
PRG="$link" | ||
else | ||
PRG=`dirname "$PRG"`"/$link" | ||
fi | ||
done | ||
SAVED="`pwd`" | ||
cd "`dirname \"$PRG\"`/" >/dev/null | ||
APP_HOME="`pwd -P`" | ||
cd "$SAVED" >/dev/null | ||
|
||
APP_NAME="Gradle" | ||
APP_BASE_NAME=`basename "$0"` | ||
|
||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||
DEFAULT_JVM_OPTS="" | ||
|
||
# Use the maximum available, or set MAX_FD != -1 to use that value. | ||
MAX_FD="maximum" | ||
|
||
warn () { | ||
echo "$*" | ||
} | ||
|
||
die () { | ||
echo | ||
echo "$*" | ||
echo | ||
exit 1 | ||
} | ||
|
||
# OS specific support (must be 'true' or 'false'). | ||
cygwin=false | ||
msys=false | ||
darwin=false | ||
nonstop=false | ||
case "`uname`" in | ||
CYGWIN* ) | ||
cygwin=true | ||
;; | ||
Darwin* ) | ||
darwin=true | ||
;; | ||
MINGW* ) | ||
msys=true | ||
;; | ||
NONSTOP* ) | ||
nonstop=true | ||
;; | ||
esac | ||
|
||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | ||
|
||
# Determine the Java command to use to start the JVM. | ||
if [ -n "$JAVA_HOME" ] ; then | ||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
# IBM's JDK on AIX uses strange locations for the executables | ||
JAVACMD="$JAVA_HOME/jre/sh/java" | ||
else | ||
JAVACMD="$JAVA_HOME/bin/java" | ||
fi | ||
if [ ! -x "$JAVACMD" ] ; then | ||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | ||
Please set the JAVA_HOME variable in your environment to match the | ||
location of your Java installation." | ||
fi | ||
else | ||
JAVACMD="java" | ||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||
Please set the JAVA_HOME variable in your environment to match the | ||
location of your Java installation." | ||
fi | ||
|
||
# Increase the maximum file descriptors if we can. | ||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then | ||
MAX_FD_LIMIT=`ulimit -H -n` | ||
if [ $? -eq 0 ] ; then | ||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | ||
MAX_FD="$MAX_FD_LIMIT" | ||
fi | ||
ulimit -n $MAX_FD | ||
if [ $? -ne 0 ] ; then | ||
warn "Could not set maximum file descriptor limit: $MAX_FD" | ||
fi | ||
else | ||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | ||
fi | ||
fi | ||
|
||
# For Darwin, add options to specify how the application appears in the dock | ||
if $darwin; then | ||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | ||
fi | ||
|
||
# For Cygwin, switch paths to Windows format before running java | ||
if $cygwin ; then | ||
APP_HOME=`cygpath --path --mixed "$APP_HOME"` | ||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | ||
JAVACMD=`cygpath --unix "$JAVACMD"` | ||
|
||
# We build the pattern for arguments to be converted via cygpath | ||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | ||
SEP="" | ||
for dir in $ROOTDIRSRAW ; do | ||
ROOTDIRS="$ROOTDIRS$SEP$dir" | ||
SEP="|" | ||
done | ||
OURCYGPATTERN="(^($ROOTDIRS))" | ||
# Add a user-defined pattern to the cygpath arguments | ||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then | ||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | ||
fi | ||
# Now convert the arguments - kludge to limit ourselves to /bin/sh | ||
i=0 | ||
for arg in "$@" ; do | ||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | ||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option | ||
|
||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition | ||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | ||
else | ||
eval `echo args$i`="\"$arg\"" | ||
fi | ||
i=$((i+1)) | ||
done | ||
case $i in | ||
(0) set -- ;; | ||
(1) set -- "$args0" ;; | ||
(2) set -- "$args0" "$args1" ;; | ||
(3) set -- "$args0" "$args1" "$args2" ;; | ||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||
esac | ||
fi | ||
|
||
# Escape application args | ||
save () { | ||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | ||
echo " " | ||
} | ||
APP_ARGS=$(save "$@") | ||
|
||
# Collect all arguments for the java command, following the shell quoting and substitution rules | ||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | ||
|
||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | ||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | ||
cd "$(dirname "$0")" | ||
fi | ||
|
||
exec "$JAVACMD" "$@" |
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.
Uh oh!
There was an error while loading. Please reload this page.