POST
|
I haven't tried it myself, but I found this method a few days ago : [INDENT]public static byte[] geometryToEsriShape(Geometry geometry) Exports geometry to the ESRI shape file format. Parameters: geometry - The geometry to export. (null value is not allowed) Returns: Array containing the exported ESRI shape file. Since: 1.0[/INDENT] You'll find this method in GeometryEngine class. Unfortunately, it seems by the name of the method that it only treats geometry, and no attributes.
... View more
11-06-2012
03:05 AM
|
0
|
0
|
376
|
POST
|
Hello, I'm currently trying to instanciate PopupViews, doing it offline. I'm basing my work on the PopupInWebmapForEditing sample. To put the popup infos into my layer, I'm using the setPopupInfos method. The parameter is a Map : popupMap.put(0, PopupInfo.fromJson(jsonParserPopup)); The json parser is based on the following json definition file :
{
\"featureCollection\": {
\"layers\": [
{
\"layerDefinition\": {
\"currentVersion\" : 10.01,
\"id\" : 5,
\"name\" : \"Batiments\",
\"type\": \"Feature Layer\",
\"geometryType\": \"esriGeometryPolygon\",
\"extent\": {
\"spatialReference\": {
\"wkid\": 102100,
\"latestWkid\": 3857
}
},
\"objectIdField\": \"OBJECTID\",
\"displayFieldName\": \"Batiments\",
\"drawingInfo\": {\"renderer\":
{\"type\": \"simple\",
\"symbol\":
{\"type\": \"esriSFS\",
\"style\": \"esriSLSSolid\",
\"color\": [255,132,0,200],
\"outline\": {
\"type\": \"esriSLS\",
\"style\": \"esriSLSSolid\",
\"color\": [0,34,255,200],
\"width\": 2}
}
}
},
\"fields\": [
{
\"name\": \"OBJECTID\",
\"alias\": \"OBJECTID\",
\"type\": \"esriFieldTypeOID\"
},
{
\"name\": \"name\",
\"alias\": \"Name\",
\"type\": \"esriFieldTypeString\"
},
{
\"name\": \"type\",
\"alias\": \"Type\",
\"type\": \"esriFieldTypeString\"
}
]
},
\"popupInfo\": {
\"title\": \"{title} ({type})\",
\"fieldInfos\": [
{
\"fieldName\": \"OBJECTID\",
\"label\": \"ID\",
\"visible\": false
},
{
\"fieldName\": \"name\",
\"label\": \"Name\",
\"visible\": true
}
],
\"description\": null,
\"showAttachments\": false,
\"mediaInfos\": [
{
\"type\": \"image\",
\"caption\": \"Caption\",
\"value\": {
\"sourceURL\": \"http://www.blank.com/fr/uploads/pics/60.jpg\",
\"linkURL\": \"http://www.blank.com/fr/uploads/pics/60.jpg\"
}
},
{
\"type\": \"image\",
\"caption\": \"Caption\",
\"value\": {
\"sourceURL\": \"http://upload.wikimedia.org/wikipedia/en/f/ff/123.jpg\",
\"linkURL\": \"http://upload.wikimedia.org/wikipedia/en/f/ff/145_logo.jpg\"
}
}
]
}
}
]
}
} [
and to instanciate my layer, I create a FeatureSet also with a json definition file:
{"currentVersion" : 10.01,
"id" : 4,
"name" : "Batiments",
"type" : "Feature Layer",
"displayField" : "OBJECTID",
"description" : "",
"copyrightText" : "",
"relationships" : [
],
"geometryType":"esriGeometryPolygon",
"objectIdField":"ObjectID",
"drawingInfo":
{"renderer":
{"type": "simple",
"symbol":
{"type": "esriSFS",
"style": "esriSLSSolid",
"color": [255,132,0,200],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [0,34,255,200],
"width": 2}
}}},
"hasAttachments" : true,
"htmlPopupType" : "esriServerHTMLPopupTypeAsHTMLText",
"objectIdField" : "OBJECTID",
"fields":[
{"name":"OBJECTID","alias":"OBJECTID","type":"esriFieldTypeOID"},
{"name":"name","alias":"Name","type":"esriFieldTypeString", "editable" : true},
{"name":"type","alias":"type","type":"esriFieldTypeString", "editable" : true}],
"capabilities" : "Query,Editing"}
Then i do this :
fLayer = new ArcGISFeatureLayer(jsonDefinition, featureSet, options);
fLayer.setPopupInfos(popupMap);
The layer shows up, the popup mechanism works also. The problem I have is that when I touch a graphics object, the popup shows up, but without anything in it. While testing, I know that the popupContainer (that I send to my PopupDialog view) has a PopupView and has genuine contents in it. Do you think is it a problem with my json definition files? What about the fact of having 2 json files? Is there a way to combine them? Thanks in advance
... View more
09-10-2012
08:15 AM
|
0
|
0
|
2346
|
POST
|
Someone posted a solution here to manage shapefiles in arcgis for android (see last post).
... View more
08-30-2012
04:58 AM
|
0
|
0
|
285
|
POST
|
Ok nevermind I managed to get this working. I'll post what I did to make this work when I finish my work 😉 UPDATE Ok so here's how i do it : 1. Parsing JSON string to get attributes and geometry, store them in an object. 2. Reproject if necessary to Web Mercator (102100) and create a Graphic object for each item in the json file. Add it to a List of Graphics. 2. Write layer definition, with GeometryType, objectIdField, renderer and fields. 3. Create a FeatureSet, then setGraphics on it with the graphics created earlier 4. Instanciate an ArcGISFeatureLayer with the layer definition, the feature set, and options mode. 5. Simply add layer to map. Ok, done. (I'll add details in some sort of tutorial if needed) The problem now is GC (Garbage Collector). I have a query where there are 3000 objects returned, geometry type : point. To do all the things above, and also including the sql query, it takes around 1 second, which I would say is not bad considering the sql query, the json parsing, the generation of 3000 Graphics etc. But next step is to actually showing the layer on the map. The layer does show up, and correctly, but after 15 to 20 seconds!
8-30 13:53:20.555: D/dalvikvm(26747): GC_CONCURRENT freed 2261K, 39% free 8878K/14407K, paused 2ms+3ms
08-30 13:53:20.766: D/dalvikvm(26747): GC_CONCURRENT freed 637K, 38% free 8981K/14407K, paused 2ms+3ms
08-30 13:53:20.993: D/dalvikvm(26747): GC_CONCURRENT freed 672K, 37% free 9083K/14407K, paused 2ms+4ms
.
.
.
08-30 13:53:37.485: D/dalvikvm(26747): GC_CONCURRENT freed 709K, 39% free 8809K/14407K, paused 2ms+3ms
08-30 13:53:37.633: D/dalvikvm(26747): GC_CONCURRENT freed 715K, 39% free 8810K/14407K, paused 2ms+3ms
08-30 13:53:37.782: D/dalvikvm(26747): GC_CONCURRENT freed 717K, 39% free 8809K/14407K, paused 2ms+4ms
08-30 13:53:40.407: D/dalvikvm(26747): GC_CONCURRENT freed 2073K, 50% free 7332K/14407K, paused 5ms+3ms This takes 20 seconds and there are around 100 GC_CONCURRENT occurrences. All of this happen just after adding the layer to the map. I have no idea why. I understand that there are thousands of objects in memory, but I don't know what exactly the GC is collecting. I used MAT on Eclipse but nothing particular showed up. Plus I don't understand why the GC doesn't free memory after showing the layer on the map. So if you have any idea about this, feel free to reply 🙂
... View more
08-29-2012
06:51 AM
|
0
|
0
|
699
|
POST
|
Hello 😄 I'm currently working on an offline app. I have an internal database (Spatialite) that allows me to generate simple GeoJSON files via an SQL query, which only specifies the geometry type and the coordinates of the object. I'm trying currently to generate a FeatureLayer from theses JSON objects. If I understand correctly, using the FeatureCollection sample and the BladeRunner source code, I would need to define a JSON output format, have a correctly formated JSON file containing my values, parse this file using the JSON definition, put the results in a Graphics object, then these in a FeatureSet, and construct my feature layer with the FeatureSet and the json definition. Is there another way to do this? Do you have something more comprehensible? because BladeRunner's workflow to decode JSOn is quite difficult to understand, while FeatureCollection doesn't really fit with my needs since it uses an online resource. Thanks in advance 🙂
... View more
08-28-2012
03:12 AM
|
0
|
4
|
5731
|
POST
|
Hello, I'm currently trying to get the Add Attachment button working as it is presented here. At the moment, using only the "Popup In Web Map For Editing Sample", the application doesn't show the option of taking a picture or select a photo, but goes directly into the gallery to select a picture. I want to show the options, just like in the link showed above. I thought it would be a permission problem but I've got everything needed to be able to take a picture or handle an intent within the application. ESRI Arcgis application on the android market has this functionality working on the same phone I am testing the sample, so it cannot come from the fact that there is a problem accessing the camera. I think that the "issue" might be in the onAddAttachment() method of PopupEditingListener interface implementation, as it only takes cares of the gallery. I wanted to add the code to handle the Camera intent but, as per the link above : "Popups make it very easy to edit media attachments for a graphic. Users can attach photos and videos to graphics either by choosing an existing item from the device's photo gallery or by using the device's camera, if one is available. You do not need to write any code to implement this functionality, it is provided by the PopupContainer." Ok, but where? Thanks for your input!
... View more
07-16-2012
07:29 AM
|
0
|
0
|
334
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|