POST
|
If you're referring to caching on the client while they are online so that they can later go offline, the TileCacheTask should be what you want, although it is tagged as being in beta as of the current 10.2.0 API. I haven't used that yet so I'm not sure what hurdles you may find during implementation. Currently I create tpks from map caches and load them in their entirety onto a device for use as an ArcGISLocalTiledLayer.
... View more
12-05-2013
07:43 AM
|
0
|
0
|
257
|
POST
|
This is still a problem. Oddly enough, while the error makes it sound like a projection issue, the problem goes away simply by changing the renderer. If I change the definition from a picture symbol to the following, the layer initializes with no errors. "drawingInfo": {
"renderer": {
"type": "simple",
"symbol": {
"type": "esriSMS",
"style": "esriSMSCircle",
"color": [
0,
52,
163,
255
],
"size": 8,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"outline": {
"color": [
0,
0,
0,
255
],
"width": 1
}
},
"label": "",
"description": ""
},
"transparency": 0,
"labelingInfo": null
}, There is definitely something odd going on here, and the error message is clearly misleading. Can someone from ESRI comment? Again, I'll be happy to provide the full JSON files for you to verify if that would help.
... View more
11-19-2013
06:48 AM
|
0
|
0
|
320
|
POST
|
This is for an ArcGISFeatureLayer that was initialized using a layer definition and feature set rather than a URL, and I think something must have changed with the way queries work in the new API. In the previous API version the following code worked as expected. I have a feature layer with a few hundred graphics, and I'm trying to query one based on an ObjectID. The following code returns a null feature set even though a graphic with the ObjectID value exists. Query query = new Query();
query.setWhere("OBJECTID = 1"); In fact, it looks like ANY where clause returns a null feature set. Even "1 = 1". If I set the geometry in addition to the where clause, I get all 400 graphics returned and the where clause is ignored. Query query = new Query();
query.setWhere("OBJECTID = 1");
query.setGeometry(mapView.getExtent()); If I loop through the features I can find the one with the ObjectID that I want, and that will be my workaround for now, but I don't understand while simply using setWhere() no longer works and why the where clause is ignored when setGeometry() is used.
... View more
11-14-2013
02:05 PM
|
0
|
0
|
732
|
POST
|
I'm sure this is a simple question, but I don't work much with Eclipse unless I'm doing something on Android, and so I'm not familiar with a lot of the options. Recently I upgraded the ArcGIS Android SDK to 10.2.0, and it has caused a lot of problems in one of the apps I'm working on. What do I need to do to roll back to 10.1.1 for just that app?
... View more
11-01-2013
12:56 PM
|
0
|
3
|
2229
|
POST
|
Recently I ran into two problems which seem to be limitations of the currently implementation of the ArcGIS Runtime SDK for Android, and so I thought I'd post this to let others know of a potential workaround. Problems: I need an offline solution so I created a tpk of the imagery, but it's almost 25 GB and the SDK doesn't seem to read tpk files > 2GB. If I create multiple tpks that are each less than 2GB, the MapView extent gets locked to the extent of the first tpk and I can't pan to the others. By creating several smaller tpks for my area of interest, I ended up with 8 tpks that only total 10 GB (ranging from 1.1 GB to 1.6 GB in size). The good news is that the SDK reads all of them just fine, and it also saves a lot total space since the tpks are all rectangular (envelope) extents, and the single tpk included large areas that I don't care about. However, I experienced the problem that I described above, whereby the MapView would initialize to the extent of the first tpk, and while I could see the edges of the adjacent tpks, I couldn't actually pan the MapView to see them all. Calling mapView.setExtent() didn't solve my problem, and neither did setting 'initExtent' in my layout.xml where I defined my MapView. My solution? Before I loaded the tpks I added an empty ArcGISFeatureLayer as the first layer in my MapView, with a service definition that specifies an extent which covers all of my tpks. The code I used (which uses the Tennessee State Plane project and encompasses the Memphis area) is below. Based on my testing, your feature definition can omit all properties except for the extent. In MyApplication/res/values/config.xml: <string name="config.fullextent.definition">
{
\"extent\": {
\"xmin\": 745209,
\"ymin\": 258815,
\"xmax\": 889493,
\"ymax\": 413469,
\"spatialReference\": {
\"wkid\": 102736,
\"latestWkid\": 2274
}
}
}
</string> In MyApplication/src/myPackage/myActivity.java: // add layer to control the overall extent
mMapView.addLayer(new ArcGISFeatureLayer(getResources().getString(R.string.config_fullextent_definition), new FeatureSet(), new Options()));
// add imagery layers
String[] imageryFiles = getResources().getStringArray(R.array.config_imagery_layers);
for (String imageryFile : imageryFiles) {
mMapView.addLayer(new ArcGISLocalTiledLayer(String.format("file://%s%s", Environment.getExternalStorageDirectory(), imageryFile)));
}
... View more
10-11-2013
12:51 PM
|
0
|
1
|
2402
|
POST
|
Any word on if this is a bug? I'd be happy to provide more information if no one on the SDK team can replicate the problem.
... View more
10-04-2013
07:08 AM
|
0
|
0
|
320
|
POST
|
If this answer helps you, please mark it as an answer. 😉 There are a couple of ways that you can go about this depending on your needs and if you are interested is saving all of the graphics in a layer at once, or if you need to save them one at a time... 1) Use a FeatureSet. Add all of graphics to a FeatureSet and then use FeatureSet.toJson() to serialize it and FeatureSet.fromJson() to deserialize it. 2) Serialize the main components of an individual graphic separately (if all you care about is geometry and you are programmatically defining a symbol, you don't really need to worry about saving the symbol or attributes). [INDENT]a) Geometry: use GeometryEngine.geometryToJson() / GeometryEngine.jsonToGeometry() b) Symbol: use Symbol.toJson() / SymbolHelper.createSymbol() c) Attributes: use new JSONObject(graphic.getAttributes()).toString() / new JSONObject(jsonAttributes)[/INDENT] In the case of the attributes for option #2, when you deserialize them you'll have to loop through jsonObject.keys() and build a Map<String, Object> of attributes to use when recreating the graphic.
... View more
10-03-2013
01:31 PM
|
0
|
0
|
189
|
POST
|
I was writing a program where I needed to check properties of various fields, and so I decided to use the ArcGISFeatureLayer.getField(String fieldName) but kept experiencing errors. The return value was always null. So as a quick test, I did this... final ArcGISFeatureLayer testLayer = new ArcGISFeatureLayer(
"http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/FeatureServer/0",
MODE.SNAPSHOT);
testLayer.setOnStatusChangedListener(new OnStatusChangedListener() {
private static final long serialVersionUID = 1L;
public void onStatusChanged(Object arg0, STATUS arg1) {
if (arg1 == STATUS.INITIALIZED) {
Field[] fields = testLayer.getFields();
Log.d(TAG, featureLayer.getName() + ": found " + fields.length + " fields");
boolean found = false;
for (Field field : fields) {
if (testLayer.getField(field.getName()) != null) {
Log.d(TAG, featureLayer.getName() + ": found field object for " + field.getName());
found = true;
}
}
if (!found) {
Log.d(TAG, featureLayer.getName() + ": no field objects found by name");
}
}
}
}); Which results in !! Current Kansas Field Production: found 23 fields
!! Current Kansas Field Production: no field object found by name Why does getField(fieldName) always return null?
... View more
10-03-2013
07:41 AM
|
0
|
1
|
3686
|
POST
|
One option is to include a Layout with a ProgressBar that is already visible when the map is launched, and then set an OnStatusChangedListener on the MapView to hide that Layout when the map is initialized. mapView.setOnStatusChangedListener(new OnStatusChangedListener() { public void onStatusChanged(Object sender, STATUS status) { if (status.equals(STATUS.INITIALIZED)) { findViewById(R.id.relativeLayoutLoading).setVisibility(View.GONE); } } }); On a side note, while I haven't actually tried it, I think you should be able to manipulate the MapView from a background thread by using runOnUiThread(). MyActivity.this.runOnUiThread(new Runnable() { public void run() { // do something } });
... View more
09-12-2013
07:50 AM
|
0
|
0
|
335
|
POST
|
Can someone from ESRI comment on whether this is a bug or if I simply misunderstand what is required in the constructor of the ArcGISFeatureLayer? Thanks!
... View more
09-09-2013
10:35 AM
|
0
|
0
|
320
|
POST
|
I'm trying to instantiate an ArcGISFeatureLayer using the constructor: public ArcGISFeatureLayer (String layerDefinition, FeatureSet featureCollection, ArcGISFeatureLayer.Options layerOption) My layer definition is a string resource (in JSON format) and the feature set is the result of a query that contains a few graphics. The map view, layer definition, and feature set all have the same spatial reference (102100), however I keep getting an error that my feature set needs to be projected. The full error is: E/ArcGIS(2057): Failed to initialize the ArcGISFeatureLayer.
E/ArcGIS(2057): java.lang.UnsupportedOperationException: The Feature collection need to be projected.
E/ArcGIS(2057): at com.esri.android.map.ags.ArcGISFeatureLayer.initLayer(Unknown Source)
E/ArcGIS(2057): at com.esri.android.map.ags.ArcGISFeatureLayer$1.run(Unknown Source)
E/ArcGIS(2057): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
E/ArcGIS(2057): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
E/ArcGIS(2057): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
E/ArcGIS(2057): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
E/ArcGIS(2057): at java.lang.Thread.run(Thread.java:856)
Oddly enough, it works if I use an empty FeatureSet and then add graphics from my existing FeatureSet. In summary, this throws an error: offlineLayer = new ArcGISFeatureLayer(layerDef, featureSet, new Options()); While this works: offlineLayer = new ArcGISFeatureLayer(layerDef, new FeatureSet(), new Options());
offlineLayer.addGraphics(featureSet.getGraphics()); Is this a bug? It's easy enough to work around, I just don't understand why the first line throws an error. Here is a sample of the query results in JSON format: {
"objectIdFieldName": "OBJECTID",
"geometryType": "esriGeometryPoint",
"spatialReference": {
"wkid": 102100
},
"fieldAliases": {
"EDITORNAME": "EDITORNAME",
"LASTUPDATE": "LASTUPDATE",
"Description": "Description",
"Category": "Category",
"CREATIONDATE": "CREATIONDATE",
"CREATORNAME": "CREATORNAME",
"OBJECTID": "OBJECTID"
},
"fields": [
{
"name": "OBJECTID",
"alias": "OBJECTID",
"type": "esriFieldTypeOID"
},
{
"name": "Category",
"alias": "Category",
"type": "esriFieldTypeString",
"length": 50
},
{
"name": "Description",
"alias": "Description",
"type": "esriFieldTypeString",
"length": 50
},
{
"name": "CREATORNAME",
"alias": "CREATORNAME",
"type": "esriFieldTypeString",
"length": 50
},
{
"name": "CREATIONDATE",
"alias": "CREATIONDATE",
"type": "esriFieldTypeDate",
"length": 36
},
{
"name": "EDITORNAME",
"alias": "EDITORNAME",
"type": "esriFieldTypeString",
"length": 50
},
{
"name": "LASTUPDATE",
"alias": "LASTUPDATE",
"type": "esriFieldTypeDate",
"length": 36
}
],
"features": [
{
"attributes": {
"OBJECTID": 1,
"Category": "Cat1",
"Description": "Desc1",
"CREATORNAME": "test",
"CREATIONDATE": 1377539896000,
"EDITORNAME": "test",
"LASTUPDATE": 1377540070000
},
"geometry": {
"x": -10015683.0399,
"y": 4189540.4191000015,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
}
},
{
"attributes": {
"OBJECTID": 2,
"Category": "Cat2",
"Description": "Desc2",
"CREATORNAME": "test",
"CREATIONDATE": 1377539898000,
"EDITORNAME": "test",
"LASTUPDATE": 1377540114000
},
"geometry": {
"x": -10009514.3383,
"y": 4190218.3222000003,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
}
}
]
} And the layer definition: {
\"currentVersion\": 10.1,
\"id\": 0,
\"name\": \"Test\",
\"type\": \"Feature Layer\",
\"description\": \"\",
\"copyrightText\": \"\",
\"defaultVisibility\": true,
\"editFieldsInfo\": {
\"creationDateField\": \"CREATIONDATE\",
\"creatorField\": \"CREATORNAME\",
\"editDateField\": \"LASTUPDATE\",
\"editorField\": \"EDITORNAME\"
},
\"ownershipBasedAccessControlForFeatures\": null,
\"syncCanReturnChanges\": false,
\"relationships\": [],
\"isDataVersioned\": true,
\"supportsRollbackOnFailureParameter\": false,
\"supportsStatistics\": true,
\"supportsAdvancedQueries\": true,
\"geometryType\": \"esriGeometryPoint\",
\"minScale\": 0,
\"maxScale\": 0,
\"extent\": {
\"xmin\": -10015683.0399,
\"ymin\": 4185636.876500003,
\"xmax\": -10005662.0863,
\"ymax\": 4190218.3222000003,
\"spatialReference\": {
\"wkid\": 102100,
\"latestWkid\": 3857
}
},
\"drawingInfo\": {
\"renderer\": {
\"type\": \"simple\",
\"symbol\": {
\"type\": \"esriPMS\",
\"url\": \"827ba8a40a3e18f97744adf3582f89b0\",
\"imageData\": \"iVBORw0KGgoAAAANSUhEUgAAABMAAAASCAYAAAC5DOVpAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAU1JREFUOI2t0zFLw0AYxvF/2tAbAg5dbKKLU1c3IZuCDg7Ouoj9AOKo30CcRATByVERowhOIiKd3EQHKSLi4kUpZOvwgm0caktMWptUn+nuOH48HPea/GPMQRdewSwo5Toi1T9hbzBhwCEiUxoO8rA6Co3MmIZFYB8Y+T6qNJVytWUtOUFwlwr7AKsJu0AlcVukjMithnUbdgwI+2K6WJxsNhpHiJT7NQYKwLYPs++wUoJ6AtOwRhBsAeoXKJr5FtxrpZYdkasuppXaRGQjJRKNjcilDws2XLSbiTwNAXViALVusxac5+CTFP+uRx5seO5i4xBouAbmhsC8zsKMHWbGQjhJYDk4a8EekE8tKVUbE3lMYCWoa6gC0xmKedFN/MG9TJhleYj0xgw4DdujZKSgXuIz+gOzwddwA7gDKaWOo60SGIADMylaEYcAvgDsemR5EOk4KgAAAABJRU5ErkJggg==\",
\"contentType\": \"image/png\",
\"width\": 14,
\"height\": 13,
\"angle\": 0,
\"xoffset\": 0,
\"yoffset\": 0
},
\"label\": \"\",
\"description\": \"\"
},
\"transparency\": 0,
\"labelingInfo\": null
},
\"hasM\": false,
\"hasZ\": false,
\"allowGeometryUpdates\": true,
\"hasAttachments\": false,
\"htmlPopupType\": \"esriServerHTMLPopupTypeAsHTMLText\",
\"objectIdField\": \"OBJECTID\",
\"globalIdField\": \"\",
\"displayField\": \"CREATORNAME\",
\"typeIdField\": \"\",
\"fields\": [
{
\"name\": \"OBJECTID\",
\"type\": \"esriFieldTypeOID\",
\"alias\": \"OBJECTID\",
\"domain\": null,
\"editable\": false,
\"nullable\": false
},
{
\"name\": \"Category\",
\"type\": \"esriFieldTypeString\",
\"alias\": \"Category\",
\"domain\": null,
\"editable\": true,
\"nullable\": true,
\"length\": 50
},
{
\"name\": \"Description\",
\"type\": \"esriFieldTypeString\",
\"alias\": \"Description\",
\"domain\": null,
\"editable\": true,
\"nullable\": true,
\"length\": 50
},
{
\"name\": \"CREATORNAME\",
\"type\": \"esriFieldTypeString\",
\"alias\": \"CREATORNAME\",
\"domain\": null,
\"editable\": false,
\"nullable\": true,
\"length\": 50
},
{
\"name\": \"CREATIONDATE\",
\"type\": \"esriFieldTypeDate\",
\"alias\": \"CREATIONDATE\",
\"domain\": null,
\"editable\": false,
\"nullable\": true,
\"length\": 36
},
{
\"name\": \"EDITORNAME\",
\"type\": \"esriFieldTypeString\",
\"alias\": \"EDITORNAME\",
\"domain\": null,
\"editable\": false,
\"nullable\": true,
\"length\": 50
},
{
\"name\": \"LASTUPDATE\",
\"type\": \"esriFieldTypeDate\",
\"alias\": \"LASTUPDATE\",
\"domain\": null,
\"editable\": false,
\"nullable\": true,
\"length\": 36
}
],
\"types\": [],
\"templates\": [
{
\"name\": \"Test\",
\"description\": \"\",
\"prototype\": {
\"attributes\": {
\"LASTUPDATE\": null,
\"Category\": null,
\"Description\": null,
\"CREATORNAME\": null,
\"CREATIONDATE\": null,
\"EDITORNAME\": null
}
},
\"drawingTool\": \"esriFeatureEditToolPoint\"
}
],
\"maxRecordCount\": 5000,
\"supportedQueryFormats\": \"JSON, AMF\",
\"capabilities\": \"Create,Delete,Query,Update,Uploads,Editing\"
}
... View more
09-05-2013
01:57 PM
|
0
|
3
|
2720
|
POST
|
I'm just curious if there are any plans in the near future for REST support for dot density symbology. Right now if I load a service with dot density symbology, the legend will show the same symbol for all categories rather than the actual unique symbols (using the Silverlight API). I haven't found any information about this in the REST forums, and the only thing I found in the Silverlight forum indicated that this was a limitation of the REST API.
... View more
07-25-2013
05:59 AM
|
0
|
1
|
1162
|
POST
|
I am in the process of setting up an environment where there will be two web adaptors behind a load balancer to serve a high-availability site. The configuration looks something like this: [ATTACH=CONFIG]20023[/ATTACH] Essentially, two physically separate ArcGIS Server sites are mirrored and attached with a NLB on the front end. Each site serves the same secured services and are configured to use the same shared key for token generation. In this scenario, ideally when the client logs in (authenticating against the built-in store) a token will be generated which will be recognized by both server sites. Is this possible? If so, what needs to be done for this to happen? I know we can adjust the affinity settings on the NLB to prevent requests from the same client from being distributed across the two sites, but the goal is complete failover. Thanks.
... View more
12-17-2012
03:17 PM
|
0
|
4
|
966
|
POST
|
In case this clarifies things further, here is the workflow that I'm trying to model: User starts ArcMap and wants to connect to a database the first time (their AD account already has permissions to the DB, but they may not yet own a version to use for editing) A temporary connection is created with the default transactional version (sde.DEFAULT) Call arcpy.ListVersions() on the temporary connection to see if the user already has a version; if not, use arcpy.CreateVersion_management() to create a private version with the user as the owner (ensures users can only edit under their version) Remove the temporary connection and create a final connection using the version owned by the user (so far I haven't seen any way to simply modify the existing connection with a script) I cannot script all four steps because as I mentioned in previous post, arcpy.CreateDatabaseConnection_management() seems ignores the version parameter (at least in the case of SQL Server using OS Authentication). If I script the first three steps, and then manually use the Create Database Connection tool from the ArcCatalog toolbox, the version will be set appropriately. That led me to attempt to build a model linking a script which does the first three steps with the tool that does the 4th step. That fails, however, because if the user doesn't already have a version in the database then the model won't run... I get "ERROR 000800: The value is not a member of sde.DEFAULT | DBO.parent" which is thrown by the Create Database Connection tool, even though I have the output from my script (which creates the version using a temporary connection) set as a precondition to running the Create Database Connection tool in the model. Using variables as input to the Create Database Connection tool doesn't seem to work well. Does anyone know of a way to successfully automate this workflow? Has anyone had any success in 10.1 with getting arcpy.CreateDatabaseConnection_management() to recognize the version parameter under SQL Server with OS Authentication? Can someone from ESRI please verify that this is indeed a bug with arcpy.CreateDatabaseConnection_management()?
... View more
09-20-2012
08:30 AM
|
0
|
0
|
599
|
POST
|
I have a Python script that which creates a database connection using arcpy.CreateDatabaseConnection_management(), and while the connection is created it ignores the version that is passed in as a parameter. The version is valid and the function does not return an error. In order to verify that the parameters were being passed appropriately, I even went so far as to edit the method management.py to print the parameters immediately before it calls: retval = convertArcObjectToPythonObject(gp.CreateDatabaseConnection_management(*gp_fixargs((out_folder_path, out_name, database_platform, instance, account_authentication, username, password, save_user_pass, database, schema, version_type, version, date), True))) In my code, I call: arcpy.CreateDatabaseConnection_management(folderName, fileName, "SQL_SERVER", instance, "OPERATING_SYSTEM_AUTH", None, None, "SAVE_USERNAME", dbName, None, "TRANSACTIONAL", "DBO.test", None)
print "Version now set to " + arcpy.Describe(folderName + "/" + fileName).connectionProperties.version In the attached screenshot the variables have been printed out in management.py immediately before creating the connection. Afterwards, you can see that while the version should be "DBO.test" it is instead "sde.DEFAULT". How can I use Python to create a SQL Server database connection using Operating System authentication with a transactional version name?
... View more
09-19-2012
11:37 AM
|
0
|
6
|
4879
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|