Skip to content

New sample: Apply mosiac rule to rasters #614

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 222 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from 218 commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
8473b0c
update api version
tschie Oct 19, 2018
51f7c30
change api version to 100.5.0
tschie Oct 19, 2018
6349008
Merge branch 'master' into dev
tschie Oct 19, 2018
b791ff8
Merge branch 'dev' into 100.5.0
tschie Oct 19, 2018
6d1ba27
change version to 100.5.0
tschie Oct 19, 2018
1f322ee
Merge branch 'master' into dev
tschie Oct 22, 2018
a240829
Merge branch 'master' into 100.5.0
tschie Oct 22, 2018
3d6ab90
Merge branch 'master' into 100.5.0
tschie Oct 23, 2018
26a21ab
Merge branch '100.5.0' into dev
tschie Oct 23, 2018
e05b73e
Merge branch 'master' into dev
tschie Oct 23, 2018
8f58533
Merge branch 'master' into dev
tschie Oct 25, 2018
75dc3a5
start updates for java 11
tschie Nov 2, 2018
e0e545c
Merge branch 'master' into dev
tschie Nov 12, 2018
8145835
Merge pull request #288 from Esri/master
Rachael-E Nov 19, 2018
a8903f0
update java 11 parts
tschie Nov 26, 2018
82e7a94
add dependencies for all platforms
tschie Nov 26, 2018
2ce991f
Delete module-info.java
tschie Nov 26, 2018
d99fad3
Merge branch 'dev' into java-11
tschie Nov 26, 2018
c8e1c13
Merge branch 'master' into dev
tschie Nov 30, 2018
d45d1ae
Merge branch 'dev' into java-11
tschie Nov 30, 2018
56ed0d5
Merge pull request #289 from Esri/java-11
tschie Nov 30, 2018
52fb4c9
Merge pull request #293 from Esri/master
Rachael-E Dec 12, 2018
42f678b
Merge branch 'master' into dev
tschie Dec 14, 2018
3a22cbb
Merge pull request #298 from Esri/master
Rachael-E Dec 18, 2018
c43331e
Merge branch 'master' into dev
tschie Dec 19, 2018
db8110b
Merge pull request #300 from Esri/master
Rachael-E Dec 21, 2018
9f2204b
Update README
Rachael-E Dec 21, 2018
a56fbdd
Update README.md
tschie Dec 21, 2018
11285fd
Merge pull request #301 from Esri/Rachael-E-patch-1
tschie Dec 21, 2018
894ed41
Merge branch 'master' into dev
tschie Dec 21, 2018
baa2198
add an integrated mesh layer sample
tschie Jan 23, 2019
b133f58
update arcgis version
tschie Jan 23, 2019
5abbed5
use javafx plugin
tschie Jan 23, 2019
2757bb5
Merge branch 'dev' into add-an-integrated-mesh-layer
tschie Jan 23, 2019
0709cbe
Merge branch 'master' into dev
tschie Jan 23, 2019
0da0c29
remove jar task config
tschie Jan 23, 2019
e1edbfe
Merge pull request #306 from Esri/add-an-integrated-mesh-layer
tschie Jan 24, 2019
f93980f
update arcgis version
tschie Jan 31, 2019
f3289a2
move stage show
tschie Jan 31, 2019
426642c
Merge pull request #309 from Esri/master
Rachael-E Feb 1, 2019
32f2a9c
Merge pull request #312 from Esri/master
Rachael-E Feb 5, 2019
b7f9b3e
Merge branch 'master' into dev
tschie Feb 5, 2019
1cb389b
Merge branch 'master' into dev
tschie Feb 5, 2019
9c53786
add point cloud data to sample data downloads
tschie Feb 5, 2019
f75253d
view point cloud data offline sample
tschie Feb 5, 2019
52c3a6d
Update build.gradle
tschie Feb 5, 2019
0a62a7d
change camera viewpoint
tschie Feb 5, 2019
1273c6e
remove unused imports
tschie Feb 5, 2019
1b0a836
update image
tschie Feb 11, 2019
d0776e4
update api version
tschie Feb 11, 2019
6e783c5
Merge pull request #316 from Esri/master
Rachael-E Feb 11, 2019
e4458f6
Merge branch 'master' into dev
tschie Feb 12, 2019
664f09a
edit about the data and additional info sections
tschie Feb 12, 2019
9cb7eae
fix comment
tschie Feb 12, 2019
93ca670
Merge pull request #315 from Esri/view-point-cloud-data-offline
tschie Feb 12, 2019
2c77dbe
Merge pull request #317 from Esri/master
Rachael-E Feb 12, 2019
dbd6a55
Removed errant full stop
Rachael-E Feb 12, 2019
1771bdb
Open Mobile Scene Package (#318)
Rachael-E Feb 20, 2019
3b7f5fe
Merge branch 'master' into dev
tschie Feb 25, 2019
8f9cdce
Map reference scale (#319)
Rachael-E Feb 26, 2019
8f95d99
Corrected title for sample
Rachael-E Mar 12, 2019
a4b8182
Merge master into dev (#322)
Rachael-E Mar 12, 2019
68e1108
Allow downloading of non zip sample data (#324)
tschie Mar 14, 2019
e006134
point scene layer sample (#323)
tschie Mar 15, 2019
f4d7324
Merge master into Dev (#329)
Rachael-E Mar 22, 2019
d144362
remove online elevation data source (#327)
Rachael-E Mar 22, 2019
d3995bf
View content beneath terrain surface (#325)
Rachael-E Mar 25, 2019
4f2f4e4
group layers sample (#331)
tschie Apr 1, 2019
cf7d52a
update version, delete extra copy of samples data
tschie Apr 1, 2019
904fb55
Play kml tours (#332)
tschie Apr 2, 2019
23e4ac2
Generate offline map with local basemap (#330)
Rachael-E Apr 3, 2019
d0c154e
Merge branch 'master' into dev
tschie Apr 4, 2019
3c7277f
pull master
tschie Apr 19, 2019
2aa00c0
Merge branch 'master' into dev
tschie Apr 23, 2019
a49a3c3
Merge branch 'master' into dev
tschie Apr 25, 2019
ba83866
Merging Master into Dev (#345)
JonLavi May 9, 2019
f84ee58
Merge `master` into `dev` (#350)
JonLavi May 17, 2019
dcecafd
merge master into dev
tschie May 28, 2019
573ae5a
Update build.gradle
tschie May 28, 2019
6cd0efc
Allows user to click a value on slider to change exaggeration (#351) …
Rachael-E May 31, 2019
ca64f2f
merge master into dev for ClosestFacilityStatic (#358)
JonLavi Jun 6, 2019
1e9a0e5
Merge branch 'master' into dev
tschie Jun 7, 2019
f876451
merge master into dev (#362)
JonLavi Jun 11, 2019
a82995b
Merge branch 'master' into dev
tschie Jun 12, 2019
1098e89
merge master into dev (#368)
JonLavi Jun 19, 2019
308013d
merge master into dev - oAuth Sample patch (#369)
JonLavi Jun 20, 2019
f3fb3a4
Tschie/split (#387)
tschie Jul 17, 2019
2875d99
fix naming
tschie Jul 18, 2019
9aac5f2
Routing around barriers (#354)
JonLavi Jul 23, 2019
23ec025
Find service areas for multiple facilities (#367)
JonLavi Jul 23, 2019
9bf071f
update screenshot
JonLavi Jul 23, 2019
02b7738
Merge branch 'patch/routing-around-barriers-screenshot' into dev
JonLavi Jul 23, 2019
23866d2
update screenshot
JonLavi Jul 23, 2019
7fbcda6
Fix comment in ColormapRendererSample.java (#391)
philium Jul 23, 2019
43f8fa3
Patch/create and save map - default challenge handler (#388)
JonLavi Jul 24, 2019
f295325
Read symbols from mobile style file (#357)
JonLavi Jul 25, 2019
7b3ca50
Update geopackage sample (#374)
JonLavi Jul 25, 2019
27ad40b
add readme metadata file
tschie Jul 25, 2019
38e3edf
Patch/oauth default challenge handler (#375)
JonLavi Jul 30, 2019
aa285f8
remove extra comma
tschie Jul 31, 2019
1e1c415
Routing around barriers - add isStillSincePress to mouse events (#394)
JonLavi Aug 1, 2019
2288f97
oauth - README.metadata.json formatting (#395)
JonLavi Aug 1, 2019
d2ea64b
mmpk to class member (#398)
JonLavi Aug 6, 2019
f00d337
Patch/dictionary symbol style update constructor (#393)
JonLavi Aug 6, 2019
dc340c2
Patch/geometry engine simplify - add isSimple check (#399)
JonLavi Aug 8, 2019
1a56d07
Integrated windows auth (#370)
JonLavi Aug 8, 2019
2d92654
update README.md for screenshot link (#403)
JonLavi Aug 8, 2019
b209569
Integrated windows auth - update README.metadata.json (#402)
JonLavi Aug 8, 2019
0e5fc1d
move local data download logic to settings.gradle (#401)
tschie Aug 9, 2019
8e43124
fixing data download for mil2505 xml file for sample viewer v2504 (#404)
JonLavi Aug 9, 2019
71375c3
fix typo
tschie Aug 9, 2019
eae4977
fix directory name
tschie Aug 9, 2019
0a4cca8
fix local data folder
tschie Aug 12, 2019
c1c2b6d
put native libraries in .arcgis folder
tschie Aug 13, 2019
5cf8674
Honor mmpk expiration (#397)
JonLavi Aug 13, 2019
959a101
Set annotation sublayer visibility (#396)
JonLavi Aug 13, 2019
a002ce2
Tschie/preplanned map (#405)
tschie Aug 15, 2019
cd1a4cc
Merge branch 'master' into dev
tschie Aug 26, 2019
9ed26f4
ignore iml files
tschie Aug 27, 2019
a0f2be8
Create and save kml file (#406)
JonLavi Aug 28, 2019
f9e744d
Apply scheduled updates to preplanned map area (#392)
JonLavi Sep 25, 2019
009b2f3
Patch/apply scheduled updates (#412)
JonLavi Oct 3, 2019
95f1ee9
Data parent directory (#413)
tschie Oct 22, 2019
f34287c
specify parent directory in File constructor
tschie Oct 22, 2019
2ef5f63
avoid explicit list of excluded directories
tschie Oct 22, 2019
6d0ef08
Merge branch 'master' into dev
tschie Oct 23, 2019
01a9bf8
show progress indicator on initial load
tschie Oct 23, 2019
bdb6833
Jon/remove unpack workflow2 (#422)
JonLavi Nov 20, 2019
8bb879c
Custom dictionary style [into dev] (#421)
JonLavi Nov 20, 2019
7ecda20
Edit kml ground overlay [into dev] (#420)
JonLavi Nov 20, 2019
afdb75a
Merge branch 'master' into dev
tschie Nov 20, 2019
d521670
add panel-region class to vbox
tschie Nov 20, 2019
e06c5fa
Display subtype feature layer (#427)
Rachael-E Dec 17, 2019
dc232c2
New Sample - Find connected features in utility network (#419)
JonLavi Jan 7, 2020
1ce5952
Update dev (#434)
Rachael-E Jan 7, 2020
60b2aae
display subtype feature layer - remove duplicate folder [dev] (#436)
JonLavi Jan 7, 2020
9d3158f
Merge branch 'master' into dev
tschie Jan 7, 2020
050dadb
Merge branch 'master' into dev
Rachael-E Feb 19, 2020
7560e54
Sync Dev with Master (#464)
JonLavi Mar 25, 2020
412037a
Merge branch 'master' into dev
tschie Apr 7, 2020
fd3a211
Fclfp hardik (#463)
Apr 13, 2020
2a85c90
Merge branch 'master' into dev
tschie Apr 20, 2020
ce35ebf
Merge branch 'master' into dev
tschie Apr 23, 2020
933dacc
Sync master into dev (#494)
JonLavi Apr 24, 2020
98cceae
Merge branch 'master' into dev
tschie Jun 8, 2020
e879c11
Merge branch 'master' into dev
tschie Jun 12, 2020
74ffdfc
Merge branch 'master' into dev
Rachael-E Jul 6, 2020
d9a13ff
Merge branch 'master' into dev
Jul 7, 2020
cddacc4
Update gradle and javafx versions (#527)
JonLavi Jul 16, 2020
4e27813
sync dev with master (#530)
JonLavi Jul 16, 2020
37114d2
Merge branch 'master' into dev
Rachael-E Jul 23, 2020
c8e6633
fix keywords in metadata.json
JonLavi Jul 23, 2020
57d0aba
fix metadata file path, title, redirect (#535)
JonLavi Jul 23, 2020
f18496b
Merge remote-tracking branch 'origin/master' into dev
JonLavi Jul 27, 2020
14ee78b
Feature enhancement to Surface Placement (#531)
jenmerritt Jul 28, 2020
b06ca29
New Sample: Realistic Lighting and Shadows (#528)
sclaridge Jul 28, 2020
a51e9f5
Update README.metadata.json (#541)
sclaridge Jul 29, 2020
06ff35d
move some slider styling into fxml file to fix sample viewer display …
jenmerritt Jul 29, 2020
c3f9b7e
Updates to Readmes (#544)
jenmerritt Aug 21, 2020
df045df
update portal item id (#546)
TADraeseke Aug 25, 2020
ba9bd94
Merge branch 'master' into dev
Aug 25, 2020
fda9bd7
Merge branch 'master' into dev
Aug 28, 2020
baafc2d
Set up sample
sclaridge Sep 3, 2020
361160b
Add UI controls
sclaridge Sep 3, 2020
feecba3
Add raster layer
sclaridge Sep 3, 2020
fd19de5
Add setMosiacRule
sclaridge Sep 3, 2020
86d8ae0
Rename files
sclaridge Sep 3, 2020
3fd88f8
Rename file
sclaridge Sep 3, 2020
b2c6174
Add list of lock raster IDs
sclaridge Sep 4, 2020
0042265
Add switch
sclaridge Sep 8, 2020
4b36776
Merge branch 'master' into 'dev' (#551)
jenmerritt Sep 8, 2020
7b6de95
Merge master into dev (#552)
sclaridge Sep 9, 2020
16b5b38
Merge branch 'master' into dev
sclaridge Sep 23, 2020
c7f1fd0
Sync dev with main (#560)
JonLavi Sep 28, 2020
a6c7857
Add url for image service
sclaridge Sep 28, 2020
c03d3fa
Fixing merge conflicts to sync main and dev (#566)
jenmerritt Oct 8, 2020
ec04025
Sync dev with main (#569)
jenmerritt Oct 13, 2020
d8e9528
New sample: Show location history (#556)
sclaridge Oct 13, 2020
24f4b80
Add progress indicator
sclaridge Oct 13, 2020
e29433e
Fix comment
sclaridge Oct 13, 2020
45adb4a
Add basemap
sclaridge Oct 14, 2020
3c50c80
Merge branch 'master' into dev
Oct 19, 2020
be60da6
Sync main and dev (#575)
jenmerritt Oct 19, 2020
c274e9d
Add authentication manager for testing
sclaridge Oct 22, 2020
1547a07
Sync main and dev (#580)
jenmerritt Oct 28, 2020
0082b77
Replace gif and screenshot (#584)
sclaridge Nov 9, 2020
25b9c87
Merge main into dev (#585)
sclaridge Nov 9, 2020
231d175
New sample: Display device location with autopan modes (#571)
sclaridge Nov 12, 2020
7f54ed6
Merge main into dev (#587)
sclaridge Nov 13, 2020
b761eba
Add jfrog artifactory to Maven repository to samples in dev branch (#…
sclaridge Nov 13, 2020
82512be
Add Exclusive Mode to Group Layers Sample (#581)
jenmerritt Nov 16, 2020
b96c3ce
Add image service raster url
sclaridge Nov 16, 2020
b85ac22
Merge branch 'master' into dev
Nov 18, 2020
a163fa5
Remove alert (#591) (#592)
sclaridge Nov 23, 2020
2f139b7
Fix Hbox width in Show location history sample (#594)
sclaridge Nov 30, 2020
1e8ea58
Merge main into dev (#596)
jenmerritt Nov 30, 2020
899bcf1
Fix hbox size and project name (#597)
sclaridge Nov 30, 2020
0498000
Add API key Gradle task to build.gradle files in samples (#593)
sclaridge Dec 8, 2020
fbe529c
Merge main into dev (#611)
jenmerritt Dec 8, 2020
b1950ee
Edit Readme
sclaridge Dec 11, 2020
d73d2b1
Merge branch 'dev' into sim11117-apply-mosiac-rule
sclaridge Dec 11, 2020
fd53949
Update build.gradle
sclaridge Dec 11, 2020
77c99cf
Update ApplyMosaicRuleToRastersSample.java
sclaridge Dec 11, 2020
6167e9a
Add image
sclaridge Dec 14, 2020
e1e36b6
Tidy comments
sclaridge Dec 14, 2020
fca016d
Update build.gradle
sclaridge Dec 14, 2020
8b30100
Add api key
sclaridge Dec 14, 2020
7ef9ea9
Update ApplyMosaicRuleToRastersSample.java
sclaridge Dec 16, 2020
a727c6e
Update ApplyMosaicRuleToRastersSample.java
sclaridge Dec 16, 2020
8a24dc3
Update ApplyMosaicRuleToRastersSample.java
sclaridge Dec 16, 2020
9535535
Update ApplyMosaicRuleToRastersSample.java
sclaridge Dec 16, 2020
7e09406
Update ApplyMosaicRuleToRastersSample.java
sclaridge Dec 16, 2020
0c15734
Rename image
sclaridge Jan 28, 2021
0aa1a57
Change arcgis version
sclaridge Jan 28, 2021
7130e50
Re order map and map view
sclaridge Feb 1, 2021
803e3a0
Tidy map view listener
sclaridge Feb 1, 2021
f234f33
Add set up UI method
sclaridge Feb 1, 2021
3094a60
Merge branch 'master' into sim11117-apply-mosiac-rule
sclaridge Feb 1, 2021
c801c07
Update year
sclaridge Feb 1, 2021
ce4c038
Add back raster layer
sclaridge Feb 1, 2021
134fdb3
Move progress indicator
sclaridge Feb 1, 2021
a3d2423
Tidy changes from PR
sclaridge Feb 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions raster/apply-mosaic-rule-to-rasters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Apply mosaic rule to rasters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to keep raster as singular throughout, unless there's a mechanism to apply a rule to a whole group of rasters in bulk?
However if the design for this is already finalised, just disregard this comment 😁

Suggested change
# Apply mosaic rule to rasters
# Apply mosaic rule to raster

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design has been finalized, so I'll stick with rasters!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Jon here, though checking the design I now understand why it's plural:

Mosaic rules are applied to mosaic datasets, which are a mesh of several rasters managed together as one


Apply mosaic rule to a mosaic dataset of rasters.

![Apply mosaic rule to rasters](ApplyMosaicRuleToRasters.png)

## Use case

An image service can use a mosaic rule to mosaic multiple rasters on-the-fly. A mosaic rule can specify which rasters are selected, and how the selected rasters are z-ordered. It can also specify how overlapping pixels from different rasters at the same location are resolved.

For example, when using the "By Attribute" mosaic method, the values in an attribute field are used to sort the images, and when using the "Center" method, the image closest to the center of the display is positioned as the top image in the mosaic. Additionally, mosaic operation allows you to define how to resolve the overlapping cells, such as choosing a blending operation.

Specifying mosaic rules is useful for viewing overlapping rasters. For example, using the "By Attribute" mosaic method to sort the rasters based on their acquisition date allows the newest image to be on top. Using "mean" mosaic operation makes the overlapping areas contain the mean cell values from all the overlapping rasters.

## How to use the sample

When the rasters are loaded, choose from a list of preset mosaic rules to apply to the rasters.

## How it works

1. Create an `ImageServiceRaster` using the service's URL.
2. Create a `MosaicRule` object and set it to the image service raster using `setMosaicRule(mosaicRule)`, if it does not specify a mosaic rule.
3. Create a `RasterLayer` from the image service raster and add it to the map.
4. Set the `mosaicMethod`, `mosaicOperation` and other properties of the mosaic rule object accordingly to specify the rule on the raster dataset.

## Relevant API

* ImageServiceRaster
* MosaicMethod
* MosaicOperation
* MosaicRule

## About the data

This sample uses a [raster image service](https://sampleserver7.arcgisonline.com/server/rest/services/amberg_germany/ImageServer) hosted on *ArcGIS Online* that shows aerial images of Amberg, Germany.

## Additional information

For more information, see [Understanding the mosaicking rules](https://desktop.arcgis.com/en/arcmap/latest/manage-data/raster-and-images/understanding-the-mosaicking-rules-for-a-mosaic-dataset.htm) from *ArcGIS Desktop* documentation. To learn more about how to define certain mosaic rules, see [Mosaic rule objects](https://developers.arcgis.com/documentation/common-data-types/mosaic-rules.htm) from *ArcGIS for Developers*.

## Tags

image service, mosaic rule, mosaic method, raster
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the checker is picking up that these aren't sorted alphabetically, gosh I wouldn't have noticed this at all otherwise!

Suggested change
image service, mosaic rule, mosaic method, raster
image service, mosaic method, mosaic rule, raster

29 changes: 29 additions & 0 deletions raster/apply-mosaic-rule-to-rasters/README.metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"category": "Raster",
"description": "Apply mosaic rule to a mosaic dataset of rasters.",
"ignore": false,
"images": [
"ApplyMosaicRuleToRasters.png"
],
"keywords": [
"image service",
"mosaic method",
"mosaic rule",
"raster",
"ImageServiceRaster",
"MosaicMethod",
"MosaicOperation",
"MosaicRule"
],
"redirect_from":"",
"relevant_apis": [
"ImageServiceRaster",
"MosaicMethod",
"MosaicOperation",
"MosaicRule"
],
"snippets": [
"src/main/java/com/esri/samples/apply_mosaic_rule_to_rasters/ApplyMosaicRuleToRastersSample.java"
],
"title": "Apply mosaic rule to rasters"
}
89 changes: 89 additions & 0 deletions raster/apply-mosaic-rule-to-rasters/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
}

group = 'com.esri.samples'

ext {
arcgisVersion = '100.10.0'
}

javafx {
version = "11.0.2"
modules = [ 'javafx.controls', 'javafx.fxml']
}

compileJava.options.encoding = 'UTF-8'

repositories {
jcenter()
maven {
url 'https://esri.jfrog.io/artifactory/arcgis'
}
maven {
url 'http://olympus.esri.com/artifactory/arcgisruntime-repo'
}
}

configurations {
natives
}

dependencies {
implementation "com.esri.arcgisruntime:arcgis-java:$arcgisVersion"
natives "com.esri.arcgisruntime:arcgis-java-jnilibs:$arcgisVersion"
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

task createGradlePropertiesAndWriteApiKey {
description = "Creates a new gradle.properties file with an empty API key variable in the user home ./gradle folder, if the file doesn't already exist."
group = "build"
def propertiesFile = new File("${System.properties.getProperty("user.home")}/.gradle/gradle.properties")
if (!propertiesFile.exists()) {
print("Go to " + new URL("https://developers.arcgis.com/dashboard") + " to get an API key.")
print(" Add your API key to ${System.properties.getProperty("user.home")}\\.gradle\\gradle.properties.")
propertiesFile.write("apiKey = ")
}
}

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 {
doFirst {
// sets the API key from the gradle.properties file as a Java system property
systemProperty 'apiKey', apiKey
Comment on lines +62 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just noticed this doesn't run the task createGradlePropertiesAndWriteApiKey, meaning it just kind of fails weirdly with a mention of apiKey, if it isn't set inside the gradle.properties already.
Should run also do that task first, or dependsOn it?
I know we've recently been implementing this, so just wondering if/where any users would find documentation when they get stuck?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The createGradlePropertiesAndWriteApiKey task should create the gradle properties file when the sample is first built. Does this happen if the sample is built, the file is deleted and the sample is run after?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to do that for me, I have to run the task createGradlePropertiesAndWriteApiKey manually. However it might just be something iffy with my setup. If it works for other people then there's nothing to worry about

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should look into this more: if Jon is coming across this as a first time using this task others will too. I can take a look on a fresh windows setup!

}
dependsOn copyNatives
mainClassName = 'com.esri.samples.apply_mosaic_rule_to_rasters.ApplyMosaicRuleToRastersLauncher'
}

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.destinationDirectory
into (project.name)
archiveBaseName = project.name
}

wrapper {
gradleVersion = '6.5.1'
}
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-6.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
172 changes: 172 additions & 0 deletions raster/apply-mosaic-rule-to-rasters/gradlew
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" "$@"
Loading