Skip to content

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

Merged
merged 43 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
12b7240
patch-closest-facility-static-readme (#363)
JonLavi Jun 14, 2019
3d6d13b
delete sample calculate distance 3D (#365)
JonLavi Jun 18, 2019
61c2af9
Patch/ClosestFacilityStatic- Edit readme 'how to use' (#364)
JonLavi Jun 18, 2019
8a12999
patch oAuth sample custom challengehandler (#366)
JonLavi Jun 20, 2019
dfd6b30
reorganize samples into separate gradle projects
tschie Jun 25, 2019
e618918
Update README.md
tschie Jun 25, 2019
73d695a
test readme markdown and metadata json files
tschie Jun 26, 2019
7e5ef52
remove duplicate directories
tschie Jun 26, 2019
f140b71
add gradle files for root to include sample projects
tschie Jun 26, 2019
3e38c49
Update settings.gradle
tschie Jun 26, 2019
a9838db
autosplit (#373)
JonLavi Jun 27, 2019
1592357
remove category packages
tschie Jun 27, 2019
ddfa30b
fix package names
tschie Jun 27, 2019
08e3996
update javafx dependencies
tschie Jun 27, 2019
8531d21
fix all compilation errors
tschie Jun 28, 2019
0c44bd9
add fxml files
tschie Jun 28, 2019
474eea0
fix main class in run configuration
tschie Jun 28, 2019
7e63436
remove ignored files
tschie Jun 28, 2019
08be7d9
configure local data for each sample
tschie Jul 1, 2019
9a4e393
Update build.gradle
tschie Jul 1, 2019
ecbf71e
reformat all readmes from html to md (#376)
JonLavi Jul 2, 2019
4ff0357
remove files
tschie Jul 2, 2019
4a49195
Metadata PR for category: Geometry (#378)
ChrisFrenchPDX Jul 3, 2019
4436be6
update metadata files
tschie Jul 3, 2019
51f6dae
Metadata PR for category: Editing (#385)
ChrisFrenchPDX Jul 3, 2019
5458593
Add metadata files for Hydrography category
ChrisFrenchPDX Jul 3, 2019
35f8921
Metadata PR for category: Scene (#383)
ChrisFrenchPDX Jul 3, 2019
f749f49
Metadata PR for category: Portal (#382)
ChrisFrenchPDX Jul 3, 2019
67dd773
Metadata PR for category: Raster (#381)
ChrisFrenchPDX Jul 3, 2019
a74a0fa
Metadata PR for category: Symbology (#380)
ChrisFrenchPDX Jul 3, 2019
06ffd47
Metadata PR for category: Search (#379)
ChrisFrenchPDX Jul 3, 2019
c3bd62f
update readme metadata
tschie Jul 3, 2019
4b45063
Merge branch 'tschie/split' of https://github.com/Esri/arcgis-runtime…
tschie Jul 3, 2019
02095b2
complete TODOs for readme metadata files
tschie Jul 3, 2019
7a076d1
Metadata PR for remaining (#386)
ChrisFrenchPDX Jul 5, 2019
b35a76d
complete TODOs in readme metadata files
tschie Jul 5, 2019
bf26bdc
update ordering of snippets
tschie Jul 5, 2019
262d7d7
update ordering of snippets
tschie Jul 5, 2019
26ec655
fix typo in name
tschie Jul 5, 2019
e903f5e
metadata fixes
tschie Jul 5, 2019
5aea0c3
Merge branch 'dev' into tschie/split
tschie Jul 5, 2019
78d2893
Merge branch 'master' into tschie/split
tschie Jul 5, 2019
b226378
Merge branch 'dev' into tschie/split
tschie Jul 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# ArcGIS Java SDK
data.zip*
bin/
build/
out/

# Local configuration file (sdk path, etc)
local.properties
.gradle/
/samples-data/
/jniLibs/
/resources/
samples-data/

# Intellij project files
*.ipr
Expand Down
83 changes: 35 additions & 48 deletions README.md
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.
Copy link
Collaborator

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...."

Copy link
Contributor Author

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.


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.
Copy link
Collaborator

Choose a reason for hiding this comment

The 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
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
Expand Down
31 changes: 31 additions & 0 deletions analysis/analyze-hotspots/README.md
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.

![](AnalyzeHotspots.png)

## 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
27 changes: 27 additions & 0 deletions analysis/analyze-hotspots/README.metadata.json
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"
}
74 changes: 74 additions & 0 deletions analysis/analyze-hotspots/build.gradle
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'
}
Binary file not shown.
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
Loading