POST
|
sorry if i'm misunderstand your question but you'll need to set up a query to excecute your query task. Here is a simplified example.
//alongside your agsquerytask set up an agsquery
@property(nonatomic, strong)AGSQueryTask* queryTask;
@property(nonatomic, strong)AGSQuery* query;
after setting up that query, maybe in viewDidLoad or wherever you'd like the query to happen you'll need to do something like this.
//set up query task
self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURL URLWithString: "your URL"]];
self.queryTask.delegate = self;
//set up query and options
self.query = [AGSQuery query];
self.query.outFields = [NSArray arrayWithObjects: "*", nil];
self.query.where = @"1=1";
//execute querytask with query
[self.queryTask executeWithQuery: self.query];
with that in place you should reach queryTask operation didExecuteWithFeatureSetResult retreivedFeatureSet where you will have access to whatever was returned from your query. Hope this helps.
... View more
12-06-2013
12:22 PM
|
0
|
0
|
273
|
POST
|
Okay, in order to get the original lat/long values you'll need to project the point back to WGS84 from web mercator. Depending on where and what you need this for it may be easier to store the x/y of the WGS point before you project to web mercator in the first place. Conversely if you don't want to reproject currentPoint, you could just create another AGSPoint to project to WGS84 and grab the x/y from that way.
currentPoint = (AGSPoint *)[[AGSGeometryEngine defaultGeometryEngine] projectGeometry:currentPoint
toSpatialReference:[AGSSpatialReference wgs84SpatialReference]];
//these should now yield your original lat/long values.
double long = [currentPoint x];
double lat = [currentPoint y];
... View more
07-31-2013
05:56 AM
|
0
|
0
|
412
|
POST
|
Hello, So long as the tpk resource is in your project, maybe you could try to display the resource this way? I was having similar problems and this solved the issue for me. Also make sure that your tpk file is included in your copy bundle resources.
NSString *mobilePath = [[NSBundle mainBundle] pathForResource:@"YourTPKName" ofType:@"tpk"];
AGSLocalTiledLayer *tiledLayer = [AGSLocalTiledLayer localTiledLayerWithPath:mobilePath];
[mapView insertMapLayer:tiledLayer withName:@"Choose a name here for access later" atIndex:0];
... View more
07-30-2013
01:46 PM
|
0
|
0
|
167
|
POST
|
Hello, If you are set up for touch events in an AGSMapView (AGSMapViewTouchDelegate), you can use the method mapView:didClickAtPoint:mapPoint:graphics: this will run any time you tap the AGSMapView. It will return graphics as well as the screen and map point that you tapped. You can then do something like this to get all the graphics registered from that tap:
NSDictionary *graphicsDictionary = graphics;//graphics being what is passed in by the method
NSArray *graphicsArray = [graphicsDictionary valueForKey:@"YourGraphicsLayerName"];
Hope this helps.
... View more
07-30-2013
01:38 PM
|
0
|
0
|
173
|
POST
|
AGSPoint has x and y properties you can use to access lat/long. so from your example
AGSPoint *currentPoint = [AGSPoint pointWithX:longValue
y:latValue
spatialReference:[AGSSpatialReference wgs84SpatialReference]];
currentPoint = (AGSPoint *)[[AGSGeometryEngine defaultGeometryEngine] projectGeometry:currentPoint
toSpatialReference:[AGSSpatialReference webMercatorSpatialReference]];
//you could get the lat long back out like so
double long = [currentPoint x];
double lat = [currentPoint y];
Sorry if i am misunderstanding this question.
... View more
07-30-2013
07:41 AM
|
0
|
0
|
412
|
POST
|
If you are using an AGSQueryTask to get back a feature set, you will need to provide a URL for the query task to query, as well as set up the spatial relationship query. If you use the delegate method*queryTask:operation:didExecuteWithFeatureSetResult:, you will have access to the feature set that is returned as well as the queryTask that was run. One of the properties of the QueryTask you get back is URL, so you could use that URL to do any operations you want to do from there like updateFeatures. Below is a partial implementation of what i mean. Even if you run two query tasks, you will still always be able to grab the correct URL. -(void)QueryTask { AGSSpatialReference *spatialRef = [AGSSpatialReference spatialReferenceWithWKID:4326]; AGSPoint *point = [[AGSPoint alloc] initWithX:longitude y:latitude spatialReference:spatialRef]; self.queryTask=[AGSQueryTask queryTaskWithURL:[NSURL URLWithString:@"YOUR_URL"]; self.queryTask.delegate = self; //make sure you have your class set as a Query Task Delegate self.query = [AGSQuery query]; self.query.geometry = point; self.query.spatialRelationship = AGSSpatialRelationshipWithin; [self.queryTask executeWithQuery:self.query]; } //results are returned - (void)queryTask:(AGSQueryTask *)queryTask operation:(NSOperation *)op didExecuteWithFeatureSetResult:(AGSFeatureSet *)retrievedFeatureSet { NSURL *URL = queryTask.URL; AGSFeatureLayer *layerToModify = [[AGSFeatureLayer alloc] initWithURL: URL mode: AGSFeatureLayerModeOnDemand]; }
... View more
04-08-2013
10:06 AM
|
0
|
0
|
369
|
POST
|
Fantastic, this was a projection issue. Using the geometry engine to project the graphic being added to the graphics layer solved my problem as the imagery layer was 102100. Thanks.
... View more
02-01-2013
11:23 AM
|
0
|
0
|
427
|
POST
|
Just to clarify, after implementing your atIndex solution the behavior is exactly the same, as always, the graphic draws when using the streets basemap, and does not draw when using the world imagery basemap
... View more
02-01-2013
07:20 AM
|
0
|
0
|
427
|
POST
|
Thanks for your reply. I am adding the layers in order, but implemented your solution As Below Code: tiledMapServiceLayerWithURL:[NSURL URLWithString:@"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"]]; [self.mapView insertMapLayer:tiledLayer withName:@"World Imagery" atIndex:0]; graphicsLayer = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:graphicsLayer withName:@"GraphicsLayer"]; End Code Later in the application, on user input, graphics are added to the graphics layer via the addGraphics method. if the above URL for the tiled layer is changed to: http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer, the street basemap, then the graphic is added to the graphics layer and appears as it should. To further complicate things, After I added the graphic in the World_Imagery situation, I tried removing the World Imagery layer to see if the graphic was behind it, but, when I remove that layer, i am left with nothing but the black screen with the checker-box pattern on it.
... View more
01-31-2013
10:26 AM
|
0
|
0
|
427
|
POST
|
I am trying to draw a graphic on an esri basemap. I started with the ESRI_StreetMap_World_2D basemap. It is created in the viewDidLoad method of my view controller like this: Code: AGSTiledMapServiceLayer *tiledLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:[NSURL URLWithString:@"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"]]; [self.mapView addMapLayer:tiledLayer withName:@"World Imagery"]; I then draw a graphic, a blue simple marker symbol, on user input. However, if i switch to http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer as my basemap, the graphic no longer draws. Is there something with the imagery layer where you cannot draw graphics on it? The only change I make to my code that results in the graphic not being drawn is changing the URL of the basemap.
... View more
01-31-2013
06:53 AM
|
0
|
6
|
1926
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|