POST
|
Promethia;226466 wrote: my code is
AGSQuery* query = [AGSQuery query];
query.where = ??????????
query.outFields = [NSArray arrayWithObjects: @"foglio", @"particella",nil];
query.returnGeometry = TRUE;
query.outSpatialReference = self.mapView.spatialReference;
[self.queryTask executeWithQuery:query];
In my project i use two UIText Field. One i use for write the number of "foglio" and one for write number of "particella". I want find the "particella" that satisfies the condition "foglio AND particella " with function query.where = ..., but i don't know how to do it. Please Help me
... View more
08-23-2012
03:35 AM
|
0
|
0
|
458
|
POST
|
Use AGSQuery and AGSQueryTask instead, for complex queries. my code is
AGSQuery* query = [AGSQuery query];
query.text = searchBar.text;
query.outFields = [NSArray arrayWithObjects: @"foglio_partic", nil];
query.returnGeometry = TRUE;
query.outSpatialReference = self.mapView.spatialReference;
[self.queryTask executeWithQuery:query];
in the log file this code is good, but not show in map the result why?? Please help me
... View more
08-22-2012
08:30 AM
|
0
|
0
|
458
|
POST
|
I have a problem. When I clicked on a zooning area open a callout with dislocure button. I want close this popup when you click on it. Help me? Thanks
... View more
08-01-2012
12:50 AM
|
0
|
1
|
644
|
POST
|
Hello all. I have a question for you. In my application I load the map services by an Institutional servers. Sometimes the addresses of the map are changed. I wanted to know what is the best way to dynamically change addresses without having to republish on apple store every time this happens. thanks
... View more
05-26-2012
01:05 AM
|
0
|
1
|
580
|
POST
|
Hy I have used the query sample code. - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { self.mapView.callout.hidden = YES; self.findParams.contains = YES; self.findParams.layerIds = [NSArray arrayWithObjects:@"1",nil]; self.findParams.outSpatialReference = self.mapView.spatialReference; self.findParams.returnGeometry = TRUE; self.findParams.searchFields = [NSArray arrayWithObjects:@"fieldName1",@"fieldName2",nil]; self.findParams.searchText = searchBar.text; [self.findTask executeWithParameters:self.findParams]; [searchBar resignFirstResponder]; } My question!!! How can i research a layer that execute a query type as: "filedName1 And fieldName2" ??? Thanks
... View more
05-11-2012
12:24 AM
|
0
|
6
|
3313
|
POST
|
How you are chaining the base map? You should use AGSMapView's insertMapLayer:withName:atIndex: method and insert base layer at index 0. Regards, Nimesh Grazie Grazie Grazie (Thanks Thanks Thanks) it now works fine
... View more
05-02-2012
08:45 AM
|
0
|
0
|
253
|
POST
|
Hi In my application i use different base map. When application is loaded for the first time, skechLayer draw up tiled map (OK), but when i change the base map the skechLayer draws down the tiled map. i used this code: AGSGraphicsLayer* graphicsLayer2 = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:graphicsLayer2 withName:@"Graphics Layer 2"]; self.sketchLayer = [AGSSketchGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:self.sketchLayer withName:@"Sketch layer"]; Why? Help me please
... View more
05-02-2012
05:41 AM
|
0
|
2
|
700
|
POST
|
Just change your didExecuteWithIdentifyResults code as following and it won't crash... - (void)identifyTask:(AGSIdentifyTask *)identifyTask operation:(NSOperation *)op didExecuteWithIdentifyResults:(NSArray *)results {
//clear previous results
[self.graphicsLayer removeAllGraphics];
if ([results count] > 0) {
//add new results
AGSSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol];
symbol.color = [UIColor colorWithRed:0 green:0 blue:1 alpha:0.5];
// for each result, set the symbol and add it to the graphics layer
for (AGSIdentifyResult* result in results) {
result.feature.symbol = symbol;
[self.graphicsLayer addGraphic:result.feature];
}
//set the callout content for the first result
//get the state name
NSString *stateName = [((AGSIdentifyResult*)[results objectAtIndex:0]).feature.attributes objectForKey:@"STATE_NAME"];
self.mapView.callout.title = stateName;
self.mapView.callout.detail = @"Click for more detail..";
//show callout
[self.mapView showCalloutAtPoint:self.mappoint forGraphic:((AGSIdentifyResult*)[results objectAtIndex:0]).feature animated:YES];
}
else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Identify Result"
message:@"No Result Found!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
//call dataChanged on the graphics layer to redraw the graphics
[self.graphicsLayer dataChanged];
} Regards, Nimesh I love you Thanks
... View more
04-18-2012
09:09 AM
|
0
|
0
|
2259
|
POST
|
i used the identify demo project to create my application. When i click out of extent of the dinamicLayer, application crashed with this error; 2012-04-15 12:42:45.037 iSIT[1427:11f03] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array' i tried to use alert view when click out of extent, but don't works. Please Help me
... View more
04-15-2012
02:47 AM
|
0
|
4
|
7679
|
POST
|
Hi in other Ersi'Api is possible to create the command "go back to extents features" and "go to next extent". I wanted to know if in ios there is this possibility. Thanks
... View more
04-14-2012
02:52 AM
|
0
|
1
|
516
|
POST
|
Hi i have a quastion. How i can create the commands for zoom back and foreward? some suggestions?
... View more
04-13-2012
06:27 AM
|
0
|
2
|
2678
|
POST
|
Nimesh you are a great It does work, but I have another question. I can not do the zoom on the address searched. Any suggestions? resolved [self.mapView zoomToScale: 2000 withCenterPoint: pt animated: YES];
... View more
04-10-2012
03:04 AM
|
0
|
0
|
528
|
POST
|
If you are using this (http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer) locator service to find addresses then you don't need to project the result geometries. Just use AGSLocator's locationsForAddress:returnFields:outSpatialReference: method and set the desired outSpatialReference. Hope this helps! Regards, Nimesh Nimesh you are a great It does work, but I have another question. I can not do the zoom on the address searched. Any suggestions?
... View more
04-10-2012
02:10 AM
|
0
|
0
|
528
|
POST
|
below formula converts 4326 latitude to 102100 latitude + (double)toWebMercatorY:(double)latitude { double rad = latitude * 0.0174532; double fsin = sin(rad); double y = 6378137 / 2.0 * log((1.0 + fsin) / (1.0 - fsin)); return y; } below formula converts 4326 longitude to 102100 longitude + (double)toWebMercatorX:(double)longitude { double x = longitude * 0.017453292519943 * 6378137; return x; } See my attachment , it contains a utility mercator convertor . You can simply import the class in your project and call the above static methods on it I have tried it with location manager and it works!!! Regards, Harikant Jammi Hi Jammi. I'm a beginner of objective-C. How can use your fantastic code in my code:
- (void)locator:(AGSLocator *)locator operation:(NSOperation *)op didFindLocationsForAddress:(NSArray *)candidates{
//check and see if we didn't get any results
if (candidates == nil || [candidates count] == 0){
//show alert if we didn't get results
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Informazione" message:@"Nessun risultato trovato" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}
else {
//use these to calculate extent of results
double xmin = DBL_MAX;
double ymin = DBL_MAX;
double xmax = -DBL_MAX;
double ymax = -DBL_MAX;
//create the callout template, used when the user displays the callout
self.calloutTemplate = [[[AGSCalloutTemplate alloc]init] autorelease];
//loop through all candidates/results and add to graphics layer
for (int i=0; i<[candidates count]; i++){
AGSAddressCandidate *addressCandidate = (AGSAddressCandidate *)[candidates objectAtIndex:i];
//get the location from the candidate
AGSPoint *pt = addressCandidate.location;
//accumulate the min/max
if (pt.x < xmin)
xmin = pt.x;
if (pt.x > xmax)
xmax = pt.x;
if (pt.y < ymin)
ymin = pt.y;
if (pt.y > ymax)
ymax = pt.y;
//create a marker symbol to use in our graphic
AGSPictureMarkerSymbol *marker = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"BluePushpin.png"];
marker.xoffset = 9;
marker.yoffset = -16;
marker.hotspot = CGPointMake(-9, -11);
//set the text and detail text based on 'Name' and 'Descr' fields in the attributes
self.calloutTemplate.titleTemplate = self.searchBar.text;
//create the graphic
AGSGraphic *graphic = [[AGSGraphic alloc] initWithGeometry: pt symbol:marker attributes:[[addressCandidate.attributes mutableCopy] autorelease] infoTemplateDelegate:self.calloutTemplate];
//add the graphic to the graphics layer
[self.graphicsLayer addGraphic:graphic];
if ([candidates count] == 1)
{
//we have one result, center at that point
[self.mapView5 centerAtPoint:pt animated:NO];
// set the width of the callout
self.mapView5.callout.width = 250;
//show the callout
[self.mapView5 showCalloutAtPoint:(AGSPoint *)graphic.geometry forGraphic:graphic animated:YES];
}
//release the graphic bb
[graphic release];
}
//if we have more than one result, zoom to the extent of all results
int nCount = [candidates count];
if (nCount > 1)
{
AGSMutableEnvelope *extent = [AGSMutableEnvelope envelopeWithXmin:xmin ymin:ymin xmax:xmax ymax:ymax spatialReference:self.mapView5.spatialReference];
[extent expandByFactor:1.5];
[self.mapView5 zoomToEnvelope:extent animated:YES];
}
}
//since we've added graphics, make sure to redraw
[self.graphicsLayer dataChanged];
} Thanks
... View more
04-08-2012
04:00 AM
|
0
|
0
|
719
|
POST
|
The complete code is this: - (void)locator:(AGSLocator *)locator operation:(NSOperation *)op didFindLocationsForAddress:(NSArray *)candidates{
//check and see if we didn't get any results
if (candidates == nil || [candidates count] == 0)
{
//show alert if we didn't get results
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Informazione"
message:@"Nessun risultato trovato"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
}
else
{
//use these to calculate extent of results
double xmin = DBL_MAX;
double ymin = DBL_MAX;
double xmax = -DBL_MAX;
double ymax = -DBL_MAX;
//create the callout template, used when the user displays the callout
self.calloutTemplate = [[[AGSCalloutTemplate alloc]init] autorelease];
//loop through all candidates/results and add to graphics layer
for (int i=0; i<[candidates count]; i++)
{
AGSAddressCandidate *addressCandidate = (AGSAddressCandidate *)[candidates objectAtIndex:i];
//get the location from the candidate
AGSPoint *pt = addressCandidate.location;
//accumulate the min/max
if (pt.x < xmin)
xmin = pt.x;
if (pt.x > xmax)
xmax = pt.x;
if (pt.y < ymin)
ymin = pt.y;
if (pt.y > ymax)
ymax = pt.y;
AGSGeometry *myPointReprojected;
myPointReprojected = [[AGSGeometryEngine defaultGeometryEngine] projectGeometry:pt toSpatialReference:[AGSSpatialReference spatialReferenceWithWKID:102100]];
//create a marker symbol to use in our graphic
AGSPictureMarkerSymbol *marker = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"BluePushpin.png"];
marker.xoffset = 9;
marker.yoffset = -16;
marker.hotspot = CGPointMake(-9, -11);
//set the text and detail text based on 'Name' and 'Descr' fields in the attributes
self.calloutTemplate.titleTemplate = self.searchBar.text;
//self.calloutTemplate.detailTemplate = @"${Descr}";
//create the graphic
AGSGraphic *graphic = [[AGSGraphic alloc] initWithGeometry: pt
symbol:marker
attributes:[[addressCandidate.attributes mutableCopy] autorelease]
infoTemplateDelegate:self.calloutTemplate];
//add the graphic to the graphics layer
[self.graphicsLayer addGraphic:graphic];
if ([candidates count] == 1)
{
//we have one result, center at that point
[self.mapView5 centerAtPoint:pt animated:NO];
// set the width of the callout
self.mapView5.callout.width = 250;
//show the callout
[self.mapView5 showCalloutAtPoint:(AGSPoint *)graphic.geometry forGraphic:graphic animated:YES];
}
//release the graphic bb
[graphic release];
}
//if we have more than one result, zoom to the extent of all results
int nCount = [candidates count];
if (nCount > 1)
{
AGSMutableEnvelope *extent = [AGSMutableEnvelope envelopeWithXmin:xmin ymin:ymin xmax:xmax ymax:ymax spatialReference:self.mapView5.spatialReference];
[extent expandByFactor:1.5];
[self.mapView5 zoomToEnvelope:extent animated:YES];
}
}
//since we've added graphics, make sure to redraw
[self.graphicsLayer dataChanged];
}
... View more
04-08-2012
03:16 AM
|
0
|
0
|
528
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|