POST
|
Hi, This is a follow-up to my previous thread ArcGISRuntimeException: Cannot call this method in this context when doing exportTile from Android and I feel that it's better to create a new thread than reviving the 1-year old one The same problem (exception) occured when I try to export a tilemap. I am using the same guide as written in Export Tiles—ArcGIS Runtime SDK for Android | ArcGIS for Developers using World_Street_Map (MapServer) as the tileURL and the exception occurs at ExportTileCacheParameters parameters = parametersFuture.get(); I believe the tile URL has its own ExportTiles method and should be callable. I am using ArcGIS SDK version 100.1.0 EDIT: I have tested with the sample server shown in the example https://sampleserver6.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer and it fails in estimating the file size exportTask.estimateTileCacheSizeAsync(params) and the result is null. The funny thing is that the scale of the exported map is only from 1000.0 - 15000.0, which is relatively small. I do not know whether there is stricter requirement in file size for the sample server. The example parameters that I sent to server: - extent = Envelope: [962596,534387, 6423288,990388, 964188,599363, 6424452,082300], [0,000000, 0,000000], [NaN, NaN] - url = World_Street_Map (MapServer) - Scale = 1000.0 - 15000.0 Thank you for any help Jason
... View more
11-12-2018
02:48 AM
|
0
|
0
|
882
|
POST
|
Shelly Gill wrote: You could create the Map from the same SpatialReference as your TPK (as tiles are not reprojected, then you'd need to do this so the layer displays). At that point the map has the full extent you wanted. Can you show me some sample code on how to do this? I cannot find any references on this in the docs or guides Let me explain the problem more clearly: So I have 2 TPK files. Let's say 1 of them covers a small portion of the city of Eugene, Oregon, USA and another one covers a small portion of Portland. That means, the 1st TPK file's region is below the 2nd TPK file's region. The problem is, when I load both of them in a basemap, I am not able to pan the map from Oregon to Portland. The panning's stuck on the region of Oregon only. Different case happens if the 2 TPKs are on the left or right of each other (Example: 1st TPK file is of Eugene, Oregon, USA and the 2nd one is of the city of Bend, Oregon, USA). In this case, I am able to pan the map to view both maps. That is why I asked whether there's a way to set the map's extent to its fullest. Thank you, Jason
... View more
11-23-2017
12:39 AM
|
0
|
0
|
538
|
POST
|
Hi, As the title suggests, I would like to know how to manually set the extent of the map which is using a basemap consisting of loaded tpk files. By default, it will only set the extent as far as the region the tpk files give, but I would like to manually set it up to cover wider area (Possibly, the maximum extent, e.g (-180, -90, 90, 180)) EDIT: I'm using Android's runtime SDK of the latest version (100.1.0)
... View more
11-14-2017
04:59 AM
|
0
|
2
|
884
|
POST
|
Thank you for the response. You actually need to give the map an instance of ArcGISMap first before accessing the map object from MapView.getMap() (It will be null originally if you don't provide a basemap through MapView.setMap()). Let's say we have 5 TPK files to be loaded. First thing to do is set the 1st TPK file inside the ArcGISMap object and add it using setMap() and then add the remaining 4 files as operational layers inside the ArcGISMap object (which contains the 1st TPK file). Is that how it works?
... View more
10-17-2017
06:42 AM
|
0
|
3
|
1265
|
POST
|
Hi, I have checked out the example on how you load a custom tile package using Basemap class and setMap(). However, there's no indication on how you can load multiple Basemap class or ArcGISTiledLayer types In the previous version of the runtime sdk (10.2.9), we can easily use Map.addLayer() to add layers, but I cannot find it anywhere on the MapView class on the latest sdk (I assume setMap() will just replace the previous one). We have quite a few of .tpk files stored in the device that we would want to display altogether Is there anyway to load multiple tpk files? or is the feature not yet in the latest release? Best regards, Jason
... View more
10-17-2017
03:44 AM
|
0
|
5
|
1883
|
POST
|
Thanks for the reply. It works with this URL and the credential supplied. I didn't realize the ArcGIS online service does not have exportTiles method Perhaps the developers for runtime SDK can make more meaningful error message than "java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context" For others who faced the same problem, here's the snippet in Kotlin val env = viewToExtent() // Similar to the sample
val minScale = 10000.0 // 1 : 10000
val maxScale = 1000.0 // 1 : 1000. Make sure maxScale < minScale
val filepath = "sdcard/mymap/test.tpk" // Path to your map file. Make sure the directories are already created
val url = "https://tiledbasemaps.arcgis.com/arcgis/rest/services/World_Topo_Map/MapServer/"
val exportTask = ExportTileCacheTask(url)
// Set the credentials, because the tiledbasemap service requires auth
exportTask.setCredential(UserCredential("<your-username>", "<your-password>"))
exportTask.addDoneLoadingListener{
val future = exportTask.createDefaultExportTileCacheParametersAsync(env, minScale, maxScale)
future.addDoneListener {
// Get parameter
val params = future.get()
// Create export job with the given param and filepath. The actual download and export happen here
val exportJob = exportTask.exportTileCacheAsync(params, filepath)
// If you care about the status of your job
exportJob.addJobChangedListener { Log.i("INFO", "jobInfo: ${exportJob.messages.last().message}") }
// When the job is done
exportJob.addJobDoneListener {
val result = job.result
if (result != null) {
// Success. The tpk file is saved to the supplied file path. The result contains the info about the TPK file
} else {
// Failed. Perhaps due to the above error, or the tpk size is too big (Dunno the exact limit)
}
}
// Start the job
exportJob.start()
}
}
exportTask.loadAsync()
Also, another bit of a problem. I noticed that the Envelope class is not serialized (or is it?).
So, is it not possible to pass the Envelope inside an Intent, to be sent to a Service / another Activity?
Thanks again for the quick response,
Jason
... View more
10-10-2017
06:52 AM
|
1
|
3
|
2142
|
POST
|
Hi, thank you for the reply. The problem still persists. I have added the exportTask.loadAsync() after adding exportTask.addDoneLoadingListener() and it's still showing the same error on the get() method. Here's the overview of my code (in Kotlin): val env = viewToExtent() // Similar to the sample
val minScale = 10000.0 // 1 : 10000
val maxScale = 1000.0 // 1 : 1000
val url = "http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"
val exportTask = ExportTileCacheTask(url)
exportTask.addDoneLoadingListener{
val future = exportTask.createDefaultExportTileCacheParametersAsync(env, minScale, maxScale)
future.addDoneListener {
val params = future.get() // ArcGISRunTimeException: Cannot call this method..
...
...
}
}
exportTask.loadAsync()
EDIT: I noticed that there's a setCredential() method from the ExportTileCacheTask.
I have not used that (and the sample uses sampleserver rather than actual ArcGIS service). Might that be the problem?
EDIT 2: Tried adding UserCredential(username, password) to the ExportTileCacheTask.setCredential(). Still the same problem
... View more
10-10-2017
01:11 AM
|
0
|
5
|
2142
|
POST
|
Hi, I am currently using the ExportTileCacheTask to export a tpk file from http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer Following the sample: arcgis-runtime-samples-android/export-tiles at master · Esri/arcgis-runtime-samples-android · GitHub The problem is, it crashes with exception java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context The exception is thrown on the line similar to line 211 of the sample ExportTileCacheParameters parameters = parametersFuture.get(); Here's the full exception log: 10-09 15:50:40.182 12160-12160/package W/System.err: java.util.concurrent.ExecutionException: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context 10-09 15:50:40.182 12160-12160/package W/System.err: at com.esri.arcgisruntime.internal.a.b.get(SourceFile:128) 10-09 15:50:40.182 12160-12160/package W/System.err: at de.maengelmelder.mainmodule.activities.MapCachingActivity$doRetrieveMapCache$1.run(MapCachingActivity.kt:184) 10-09 15:50:40.182 12160-12160/package W/System.err: at android.os.Handler.handleCallback(Handler.java:739) 10-09 15:50:40.182 12160-12160/package W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95) 10-09 15:50:40.192 12160-12160/package W/System.err: at android.os.Looper.loop(Looper.java:145) 10-09 15:50:40.192 12160-12160/package W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5951) 10-09 15:50:40.192 12160-12160/package W/System.err: at java.lang.reflect.Method.invoke(Native Method) 10-09 15:50:40.192 12160-12160/package W/System.err: at java.lang.reflect.Method.invoke(Method.java:372) 10-09 15:50:40.192 12160-12160/package W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 10-09 15:50:40.192 12160-12160/package W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 10-09 15:50:40.192 12160-12160/package W/System.err: Caused by: com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context 10-09 15:50:40.192 12160-12160/package W/System.err: at com.esri.arcgisruntime.internal.a.b.get(SourceFile:120) 10-09 15:50:40.192 12160-12160/package W/System.err: ... 9 more There's no more indication of the error or the cause of it. Any possible cause or solution? Thanks before, Jason
... View more
10-09-2017
06:54 AM
|
0
|
7
|
3885
|
POST
|
Hi, I am planning to use an offline vector basemap for an android app. Here's where I found the information Vector tile layers—ArcGIS Online Help | ArcGIS It says that the support for Runtime SDKs will be available on 2017, but the page in German language says that it is supported in 2016. If it is already supported in Android's runtime SDK, can anyone tell me on: How to make the vector basemap files? What are the extensions of the file? Can it be produced using Android's ArcGIS Desktop Pro? Where do I put the files ? inside the SDcard or can it be accessible inside android's asset / raw folder? How can I access it and apply it to the map using Android's runtime SDK? It'll be great if there's a tutorial or a sample code on how to do them. Thank you
... View more
12-21-2016
05:34 AM
|
0
|
1
|
1165
|
POST
|
Hi, Suppose that I have a very small (1-2MBs) TPK file that I want to package along with the released APK, how can I reference it from raw or assets folder? What string should I pass for the ArcGISLocalTiledLayer's constructor to display it on to the map?
... View more
11-29-2016
11:03 PM
|
0
|
2
|
1124
|
POST
|
Currently, I don't have a problem with storing data on a Graphic marker (because I just changed the algorithm to just search on the list of objects rather than type-casting the attributes from HashMap). I just want to address the problem of not being able to retrieve objects from attributes from Graphic marker
... View more
11-28-2016
05:53 AM
|
0
|
2
|
821
|
POST
|
Currently only String is supported on the android's arcgis SDK. Aside from POJO, you can also use GSON to store the data structure as JSON string. But, for a complex object, it might not suffice.
... View more
11-28-2016
05:42 AM
|
0
|
4
|
821
|
POST
|
It's on version 10.2.8-1 The objects are just plain made Java object. (e.g. a custom data structure)
... View more
11-28-2016
05:25 AM
|
0
|
6
|
821
|
Title | Kudos | Posted |
---|---|---|
1 | 10-25-2016 12:31 AM | |
1 | 10-10-2017 06:52 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|