-
Notifications
You must be signed in to change notification settings - Fork 123
Tschie/split #387
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
Tschie/split #387
Changes from all commits
12b7240
3d6d13b
61c2af9
8a12999
dfd6b30
e618918
73d695a
7e5ef52
f140b71
3e38c49
a9838db
1592357
ddfa30b
08e3996
8531d21
0c44bd9
474eea0
7e63436
08be7d9
9a4e393
ecbf71e
4ff0357
4a49195
4436be6
51f6dae
5458593
35f8921
f749f49
67dd773
a74a0fa
06ffd47
c3bd62f
4b45063
02095b2
7a076d1
b35a76d
bf26bdc
262d7d7
26ec655
e903f5e
5aea0c3
78d2893
b226378
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,67 @@ | ||
# ArcGIS Runtime Java SDK Samples | ||
### 100.5.0 | ||
This project includes a set of samples demonstrating how to accomplish various mapping and GIS tasks with the ArcGIS Runtime SDK for Java. | ||
|
||
Be sure to also check out our [toolkit on GitHub](https://github.com/Esri/arcgis-runtime-toolkit-java). | ||
Here is a collection of sample projects demonstrating how to accomplish various mapping and GIS tasks with the ArcGIS Runtime SDK for Java. | ||
|
||
These samples are built with Gradle. If you want to learn more about Gradle, learn more from [Gradle's guide](https://docs.gradle.org/current/userguide/userguide.html). | ||
Browse the category directories to explore the samples. Each sample is an individual [Gradle](https://docs.gradle.org/current/userguide/userguide.html) project that can be run standalone. The Gradle buildscripts have tasks for running the application, building a jar, and distributing the app as a zip. | ||
|
||
This guide has instructions for running samples using the command line or with Eclipse and IntelliJ IDEA. | ||
Installing Gradle is not necessary since each sample includes the Gradle wrapper. | ||
|
||
For developers new to Git, please see the wiki page for how to [clone this repository](https://github.com/Esri/arcgis-runtime-samples-java/wiki/working-with-git). | ||
## Instructions | ||
|
||
## Running the Samples | ||
To run the samples in a terminal, `cd` into the project and call the gradle `run` task, supplying the sample main class: | ||
### IntelliJ IDEA | ||
|
||
On Linux/Mac | ||
``` | ||
$ ./gradlew run -PmainClass="com.esri.samples.scene.display_scene.DisplaySceneSample" | ||
``` | ||
1. Open IntelliJ IDEA and select _File > Open..._. | ||
2. Choose one of the sample project directories (not the category folder) and click _OK_. | ||
3. Select _File > Project Structure..._ and ensure that the Project SDK and language level are set to use Java 11. | ||
4. Open the Gradle view with _View > Tool Windows > Gradle_. | ||
5. In the Gradle view, double-click the `run` task under _Tasks > application_ to run the app. | ||
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. We need some additional doc here to describe the option of running the samples using the launcher. Using the launcher doesn't require JavaFX to be installed, whereas running the class directly does (and the module path set to the JavaFX install directory): do we want to alert our users to this alternative workflow? |
||
|
||
On Windows | ||
``` | ||
> gradlew.bat run -PmainClass="com.esri.samples.scene.display_scene.DisplaySceneSample" | ||
``` | ||
### Eclipse | ||
|
||
If no `mainClass` property is supplied, the default sample (set in the build.gradle file) will be run. | ||
1. Open Eclipse and select _File > Import_. | ||
2. In the import wizard, choose _Gradle > Existing Gradle Project_, then click _Next_. | ||
3. Choose one of the sample project directories (not the category folder) as the project root directory. | ||
4. Click _Finish_ to complete the import. | ||
5. Open the Gradle Tasks view with _Window > Show View > Other... > Gradle > Gradle Tasks_. | ||
6. In the Gradle Tasks view, double-click the `run` task under _{project_name} > application_ to run the app. | ||
|
||
There is no need to install Gradle to run the samples. | ||
### Terminal | ||
|
||
## Java 11 | ||
1. `cd` into one of the sample project directories (not the category folder). | ||
2. Run `./gradlew run` on Linux/Mac or `gradlew.bat run` on Windows to run the app. | ||
|
||
### Java 11 | ||
Java 11 users may find exceptions when running the project if their library path is still set for Oracle JDK 1.8 (see the [OpenJavaFX docs](https://openjfx.io/openjfx-docs/) for more information). A workaround for this is to add the following argument in the `run` task of the Gradle buildscript: | ||
``` | ||
systemProperty "java.library.path", "C:\tmp" | ||
``` | ||
|
||
## Offline sample data | ||
### Offline sample data | ||
JonLavi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Some samples require offline data. A `samples-data` directory will automatically download to the project root the | ||
first time you call the `run` task. | ||
|
||
## Importing into an IDE | ||
We will step through how to import the Samples project into Eclipse and IntelliJ IDEA. Other IDEs may support Gradle too. Please consult their documentation for importing Gradle projects. | ||
|
||
### IntelliJ IDEA | ||
After cloning the samples, open IntelliJ IDEA and follow these steps: | ||
|
||
1. Click *Import Projects* from the Welcome Screen or select *File > New > Project from Existing Sources*. | ||
2. In the select path dialog, select the `build.gradle` file in the `arcgis-runtime-samples-java` directory. Click *OK* after specifying the `build.gradle` file. | ||
3. Click *OK* at the next dialog to complete the import. | ||
first time you call the `run` task. To refresh the data, you can run the `clean` and `unpackData` tasks. | ||
|
||
<img src="./intellij_proj.png" alt="IntelliJ IDEA project structure" height="200"> | ||
## Requirements | ||
|
||
To view all of the gradle tasks including the Run task, go to *View > Tool Windows > Gradle*. | ||
|
||
Alternatively, you can open the sample's main class, right-click, and select *Run* from the dropdown menu. | ||
|
||
### Eclipse | ||
To import the samples with Eclipse's default gradle plugin, follow these steps: | ||
|
||
1. Open Eclipse and select *File > Import*. | ||
2. In the import wizard, choose *Gradle > Gradle Project*, then click Next. | ||
3. Select the `arcgis-runtime-samples-java` directory as the project root directory. | ||
4. Click *finish* to complete the import. | ||
|
||
<img src="./eclipse_proj.png" alt="Eclipse project structure" height="200"> | ||
See the Runtime SDK's [system requirements](https://developers.arcgis.com/java/latest/guide/system-requirements-for-quartz.htm). | ||
|
||
## Resources | ||
|
||
* [ArcGIS Runtime SDK for Java](https://developers.arcgis.com/java/) | ||
* [Toolkit](https://github.com/Esri/arcgis-runtime-toolkit-java) | ||
* [ArcGIS Blog](https://blogs.esri.com/esri/arcgis/) | ||
* [Esri Twitter](https://twitter.com/esri) | ||
|
||
## Issues | ||
|
||
Find a bug or want to request a new feature? Please let us know by submitting an issue. | ||
|
||
## Contributing | ||
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). | ||
|
||
Find a bug or want a new feature? Please let us know by submitting an issue. | ||
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). | ||
|
||
## Licensing | ||
Copyright 2018 Esri | ||
|
||
Copyright 2019 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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Analyze Hotspots | ||
|
||
Perform hotspot analysis using a geoprocessing service. | ||
|
||
In this case, frequency of 911 calls in an area are analyzed. | ||
|
||
 | ||
|
||
## How to use the sample | ||
|
||
Select a start and end date using the datepickers between 1/1/1998 and 5/31/1998 respectively. Click the "Analyze hotspots" button to start the geoprocessing job. | ||
|
||
## How it works | ||
|
||
To analyze hotspots using a geoprocessing service: | ||
|
||
1. Create a `GeoprocessingTask` with the URL set to the endpoint of the geoprocessing service. | ||
2. Create a query string with the date range as an input of `GeoprocessingParameters`. | ||
3. Use the `GeoprocessingTask` to create a `GeoprocessingJob` with the parameters. | ||
4. Start the job and wait for it to complete and return a `GeoprocessingResult`. | ||
5. Get the resulting `ArcGISMapImageLayer` using `geoprocessingResult.getMapImageLayer()`. | ||
6. Add the layer to the map's operational layers. | ||
|
||
## Relevant API | ||
|
||
* ArcGISMapImageLayer | ||
* GeoprocessingJob | ||
* GeoprocessingParameters | ||
* GeoprocessingResult | ||
* GeoprocessingString | ||
* GeoprocessingTask |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"category": "Analysis", | ||
"description": "Perform hotspot analysis using a geoprocessing service.", | ||
"ignore": false, | ||
"images": [ | ||
"AnalyzeHotspots.png" | ||
], | ||
"keywords": [ | ||
"Geoprocessing", | ||
"GeoprocessingJob", | ||
"GeoprocessingParameters", | ||
"GeoprocessingResult" | ||
], | ||
"redirect_from": "/java/latest/sample-code/analyze-hotspots.htm", | ||
"relevant_apis": [ | ||
"ArcGISMapImageLayer", | ||
"GeoprocessingJob", | ||
"GeoprocessingParameters", | ||
"GeoprocessingResult", | ||
"GeoprocessingString", | ||
"GeoprocessingTask" | ||
], | ||
"snippets": [ | ||
"src/main/java/com/esri/samples/analyze_hotspots/AnalyzeHotspotsSample.java" | ||
], | ||
"title": "Analyze Hotspots" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
plugins { | ||
id 'application' | ||
id 'org.openjfx.javafxplugin' version '0.0.5' | ||
} | ||
|
||
group = 'com.esri.samples' | ||
|
||
ext { | ||
arcgisVersion = '100.5.0' | ||
} | ||
|
||
javafx { | ||
version = "11.0.1" | ||
modules = [ 'javafx.controls' ] | ||
} | ||
|
||
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" | ||
} | ||
|
||
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.analyze_hotspots.AnalyzeHotspotsLauncher' | ||
} | ||
|
||
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' | ||
} |
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 |
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.
Minor suggestion here - this intro seems a little casual to me. I prefer the more structured/professional approach of our initial intro, and would suggest the following intro:
"This repository contains a collection of sample projects...."
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.
I noticed that we were not following the Esri guidelines for our repo structure, which is why I changed it. But your suggestion sounds better.