|
POST
|
http://forums.arcgis.com/threads/43411-I-was-tasked-to-create-a-curved-polyline-using-Flex-API-and-wanted-to-share-my-work.
... View more
02-13-2012
08:31 PM
|
0
|
0
|
476
|
|
POST
|
Steven, this sample code works perfectly. Can you show your code? What version of ArcGIS API for Flex is used?
... View more
02-08-2012
06:10 AM
|
0
|
0
|
284
|
|
POST
|
bojan, reading of my current GPS position "Hello Android" book has one small sample of Location Tests: LocationTest/res/layout/main.xml LocationTest/src/org/example/locationtest/LocationTest.java LocationTest/AndroidManifest.xml all sample sources of this book are here adding/storing a new point feature at my location in activity java code (actually to send something to server you need only red part of code): // on your save button click handler function call AsyncTask
new AddFeaturesTask().execute();
// this may be placed in your activity java class body
private class AddFeaturesTask extends AsyncTask<Void, Integer, Boolean> {
ProgressDialog progress = null;
/* (non-Javadoc)
* @see android.os.AsyncTask#onCancelled()
*/
@Override
protected void onCancelled() {
super.onCancelled();
}
/* (non-Javadoc)
* @see android.os.AsyncTask#onPreExecute()
*/
@Override
protected void onPreExecute() {
super.onPreExecute();
// do something - show dialog for example
progress = ProgressDialog.show(...);
}
/* (non-Javadoc)
* @see android.os.AsyncTask#onPostExecute(java.lang.Object)
*/
@Override
protected void onPostExecute(Boolean result) {
super.onPostExecute(result);
// hide progress dialog if it's shown
if (progress != null && progress.isShowing()) {
progress.dismiss();
}
if (result) {
// do something - alert user...
} else {
// do something - alert user, save data locally ...[depends on application business logic]
}
}
@Override
protected Boolean doInBackground(Void... arg0) {
try {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("your layer url" + "/applyEdits");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
// add token, if your services are secured
nameValuePairs.add(new BasicNameValuePair("token parameter here", "your token"));
// json array of graphics you need to add - use your own JSON converter or
String arrayAsJsonString = MyJsonHelper.fromGraphicsToJsonString(arrGraphics);
nameValuePairs.add(new BasicNameValuePair("adds", arrayAsJsonString));
// add response format if you need to parse results
nameValuePairs.add(new BasicNameValuePair("f", "pjson"));
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity entity = response.getEntity();
String responseResult = inputStreamToString(entity.getContent());
// check response result is success to continue
boolean isSaved = isSuccess(responseResult, 1);
if (isSaved) {
return true;
}
}
} catch (SSLPeerUnverifiedException spuex) {
Log.d(TAG, spuex.getMessage());
} catch (ClientProtocolException cpex) {
Log.d(TAG, cpex.getMessage());
} catch (IOException ioex) {
Log.d(TAG, ioex.getMessage());
} catch (IllegalArgumentException iaex) {
Log.d(TAG, iaex.getMessage());
} catch (Exception ex) {
Log.d(TAG, ex.getMessage());
}
return false;
}
private boolean isSuccess(String responseResult, int index) {
if (responseResult != null && responseResult.length() > 0) {
try {
JSONObject responseJSON = new JSONObject(responseResult);
if (responseJSON != null) {
JSONArray addResultsArray = responseJSON.getJSONArray(ADDRESULTS_TAG);
// do something with results if needed
// parse results and return true if sucess
return true;
}
} catch (JSONException jsex) {
Log.d(TAG, jsex.getMessage());
} catch (Exception ex) {
Log.d(TAG, ex.getMessage());
}
return false;
}
/**
* Read response content
*/
private String inputStreamToString(InputStream is) {
StringBuilder sb = new StringBuilder();
String line = "";
// Wrap a BufferedReader around the InputStream
BufferedReader rd = new BufferedReader(new InputStreamReader(is));
// Read response until the end
try {
while ((line = rd.readLine()) != null) {
sb.append(line);
}
rd.close();
} catch (IOException ioex) {
Log.d(TAG, ioex.getMessage());
} catch (Exception ex) {
Log.d(TAG, ex.getMessage());
}
// Return full string
return sb.toString();
}
} from MyJsonHelper class:
private static final String X_KEY = "x";
private static final String Y_KEY = "y";
private static final String GEOMETRY_KEY = "geometry";
private static final String ATTRIBUTES_KEY = "attributes";
/**
* @param array of com.esri.core.map.Graphic objects
* @return String representation of JSON array
*/
public static String fromGraphicsToJsonString(Graphic[] graphics) {
if (graphics != null) {
try {
JSONArray arr = new JSONArray();
for (Graphic graphic : graphics) {
Geometry geometry = graphic.getGeometry();
Map<String, Object> attributes = graphic.getAttributes();
if (geometry != null && geometry.getType() == Geometry.Type.Point && attributes != null) {
Point pt = (Point)geometry;
double xValue = pt.getX();
double yValue = pt.getY();
Map<String, Double> geometryMap = new TreeMap<String, Double>();
geometryMap.put(X_KEY, xValue);
geometryMap.put(Y_KEY, yValue);
JSONObject geometryObj = new JSONObject(geometryMap);
JSONObject attributesObj = new JSONObject(attributes);
Map<String, JSONObject> feature = new TreeMap<String, JSONObject>();
feature.put(GEOMETRY_KEY, geometryObj);
feature.put(ATTRIBUTES_KEY, attributesObj);
JSONObject featureObj = new JSONObject(feature);
arr.put(featureObj);
} else {
// add empty feature
JSONObject geometryObj = new JSONObject();
JSONObject attributesObj = new JSONObject();
Map<String, JSONObject> feature = new TreeMap<String, JSONObject>();
feature.put(GEOMETRY_KEY, geometryObj);
feature.put(ATTRIBUTES_KEY, attributesObj);
JSONObject featureObj = new JSONObject(feature);
arr.put(featureObj);
}
}
if (arr != null && arr.length() > 0) {
return arr.toString();
}
} catch (NullPointerException npex) {
if (npex.getMessage() != null)
Log.d(TAG, npex.getMessage());
else
Log.d(TAG, npex.toString());
} catch (Exception ex) {
Log.d(TAG, ex.getMessage());
}
}
return null;
}
... View more
02-06-2012
03:53 AM
|
0
|
0
|
444
|
|
POST
|
Steven, is there a nice quick easy way to add a 5px tolerance around the point thats clicked?
var q:Query = new Query();
if (yourgeometry is MapPoint)
{
var mappoint:MapPoint = yourgeometry as MapPoint;
var newextent:Extent = new Extent(); // not a buffered point, but it works
var delta:Number = 10;
newextent.minx = mappoint.xvalue -delta;
newextent.miny = mappoint.yvalue -delta;
newextent.maxx = mappoint.xvalue +delta;
newextent.maxy = mappoint.yvalue +delta;
q.geometry = newextent;
}
else
{
q.geometry = yourgeometry;
} You can also buffer your geometry using GeometryService - http://help.arcgis.com/en/webapi/flex/samples/01nq/01nq00000023000000.htm
... View more
02-01-2012
01:53 AM
|
0
|
0
|
666
|
|
POST
|
http://code.google.com/p/as3shplib/ http://code.google.com/p/vanrijkom-flashlibs/ Let them lie down here.
... View more
02-01-2012
01:39 AM
|
0
|
0
|
499
|
|
POST
|
instructions you gave me does it give me a result that looks like this one ... I tried to show where to find answers to your questions - that's all. Do you want to copy/paste some code? - I'll stand on the sidelines. Do you have plan to develop? You do not like the implementation of the code proposed by other developers. You have some part of own code to show, with better solution - Let's discuss it. Did you see this sample? http://help.arcgis.com/en/webapi/flex/samples/01nq/01nq00000026000000.htm - load/read/parse XML - implemented, show basic information on map - implemented (click to points on map shows InfoWindow). P.S. If you think you have not found an answer to your question, may be you need to write more detailed description of your problem.
... View more
01-30-2012
11:42 PM
|
0
|
0
|
675
|
|
POST
|
sherlyann23, All "very new" to this starts with reading documentation, look to samples provided by ESRI developers, use this forum search. Try to use GeometryService to project geometries. Take a look to live samples of this service usage. This resource provides the service description associated with a geometry service and is primarily a processing and algorithmic resource that supports operations related to geometries.
... View more
01-30-2012
10:13 PM
|
0
|
0
|
675
|
|
POST
|
sherlyann23, 1 - parse XML - as a result "x" and "y" values (one pair if point, more paths if line or area) and some attributes ( com.esri.viewer.utils.GeoRSSUtil in ArcGIS Flex Viewer source code - u can get some ideas how to parse xml ) 2 - create geometry based on "x" and "y" values (1) 3 - create graphic based on geometry (2) and attributes (1) 4 - add graphic (3) to your graphicslayer 5 - show info window Most of Classes has links to usage examples. Esri Flex Samples catalog - here.
... View more
01-27-2012
02:18 AM
|
0
|
0
|
675
|
|
POST
|
Nolo, no (I did not found any). Use HttpService (we used it).
... View more
01-24-2012
07:15 AM
|
0
|
0
|
780
|
|
POST
|
Neither the Map class, the TimeSlider class nor the Layer class seem to allow for addEventListener(TimeExtentEvent.TIME_EXTENT_CHANGE). :confused: TimeSlider - > timeExtentChange (Since : ArcGIS API for Flex 2.0) Map - > timeExtentChange In one of ESRI samples find the way how to implement it. P.S. From adobe.
... View more
01-23-2012
09:21 PM
|
0
|
0
|
606
|
|
POST
|
If your "Standart application" built on Flex API from ESRI - the first link in may last thread - it works. If your "Standart application" is Flex Viewer from ESRI - http://help.arcgis.com/en/webapps/flexviewer/help/01m3/01m300000008000000.htm - it works. All other flex applications - the second link in my last thread - it works. P.S. 'Find an address" or "I Want to...." or "Loading.." - where did you got it? If it is your code - so why you can not change it?
... View more
01-23-2012
09:06 AM
|
0
|
0
|
425
|
|
POST
|
1 From adobe reference result:Function â?? Function that should be called when the request has completed successfully. Must have the following signature: public function (result:Object, token:Object = null):void; :confused: void - Specifies that a function cannot return any value. // variable=reciever layer
// function getLayer(layerId:Number):Layer returns some data with type Layer
var layer:Layer = myMap.getLayer(layerId);
// no variable=reciever
// function can not return any value
layer.refresh(); // refresh():void so what variable=reciever gets data, when your function works function onResult(featureSet:FeatureSet, token:Object = null):Number ? 2 function SearchSaleTable works, and never pause or stop working to wait your result or fault function. you need a pencil and a piece of paper (maybe even two pieces of paper) on which you describe everything in detail the entire cycle of receiving and processing data. So the green part of code never wait for red part of code, right? private function SearchSaleTable(tmp:ArrayCollection):Number
{
cursor = tmp.createCursor();
var t:String = new String;
while(!cursor.afterLast)
{
t = cursor.current.toString();
var saleQueryTask:QueryTask = new QueryTask();
saleQueryTask.url = "my url";
saleQueryTask.showBusyCursor = true;
saleQueryTask.useAMF = false;
sQuery.where = "SAPROP = '" + t + "'" ;
saleQueryTask.execute(sQuery, new AsyncResponder(onResult, onFault));
function onResult(featureSet:FeatureSet, token:Object = null):void
{
nsum = 0;
for each (var g:Graphic in featureSet.features)
{
nsum += g.attributes.SAPRICE;
}
trace("on Result " + nsum);
sumSaleValue = sumSaleValue + nsum;
}
function onFault(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
cursor.moveNext()
}
return sumSaleValue;
} Try to remove/comment all places you call trace function. Put in other places:
private function SearchSaleTable(tmp:ArrayCollection):Number
{
trace(">>>start of SearchSaleTable()");
...
...
trace("query send")
saleQueryTask.execute(sQuery, new AsyncResponder(onResult, onFault));
...
...
function onResult(featureSet:FeatureSet, token:Object = null):void
{
trace("result recieve");
...
...
trace(">>>end of SearchSaleTable()");
return sumSaleValue;
my be it helps.
... View more
01-23-2012
08:44 AM
|
0
|
0
|
801
|
|
POST
|
http://help.arcgis.com/en/webapi/flex/help/017p/017p00000007000000.htm - esri help http://www.adobe.com/devnet-apps/flex/tourdeflex/web/ - adobe sample (search for "Localization")
... View more
01-23-2012
07:03 AM
|
0
|
0
|
425
|
|
POST
|
David, http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/System.html
... View more
01-22-2012
08:39 PM
|
0
|
0
|
279
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-03-2017 11:25 PM | |
| 1 | 10-06-2016 11:49 PM | |
| 2 | 06-07-2012 01:38 AM | |
| 1 | 06-03-2012 09:42 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|