POST
|
I tried to set up AGSMapView's maxEnvelope property with tracked xmin, ymin, xmax and ymax values of mapAnchor property in each direction /** The map coordinates of where the map display is anchored.
Usually this is the center of the map. However it could be different. For example, if the map is anchored on the location display, this will be the coordinate
of the location display.
@agssince{10.1.1, 10.2}
*/
@property (nonatomic, copy, readonly) AGSPoint *mapAnchor;
/** Limits the amount by which the map can be panned such that its anchor point (typically the center) never goes outside
this envelope. By default, this is the full envelope of the basemap layer. If you set a custom extent,
the envelope must have the same spatial reference as the map.
@agssince{2.1, 10.2}
*/
@property (nonatomic, strong, readwrite) AGSEnvelope *maxEnvelope; Values: xmin: -20031541, ymin: -19971868 xmax: 20032312, ymax: 19971819 It helped controlling the panning a little but only for a specific zoom level. At full extent the problem still exists (grid still shows) and there's still no clear solution to zooming out of extent.
... View more
06-15-2014
02:35 AM
|
0
|
0
|
420
|
POST
|
I'm using an AGSMapView with a AGSTiledMapServiceLayer for basemap layer as follows; - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSURL *basemapURL = [[NSURL alloc] initWithString:@"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"];
AGSTiledMapServiceLayer *basemapLayer = [AGSTiledMapServiceLayer tiledMapServiceLayerWithURL:basemapURL];
[mapView addMapLayer:basemapLayer withName:@"Basemap Tiled Layer"];
mapView.layerDelegate = self;
mapView.touchDelegate = self;
} The app opens up as in the first attached photo, and it can be zoomed out and panned like in the 2nd photo. I read somewhere that setting the mapView's maxEnvelope property is the only way to limit zooming/panning, however I couldn't get my finger around the envelope value I should be setting and I tried [mapView toMapEnvelope:CGRect]. I also tried working with the base layer's minScale and maxScale values but that didn't work either. I had a successful try with tracking the map scale via AGSMapViewDidEndZoomingNotification to restore it to fit the screen when zoomed out too much, however that didn't prevent me from seeing the outsider grid around the map for a while, and I didn't know which value to monitor if I decided to listen for AGSMapViewDidEndPanningNotification as well.
... View more
06-12-2014
02:24 AM
|
0
|
1
|
4341
|
POST
|
Well well, that seems to be about right. I didn't think that was it because the map was getting me to the correct location only without the symbol. I also believed that AGSGeometryWithJSONAndSR() would set the desired SR for the geometry. But after checking on the wkid for both the geometry and the map it was clear they are not the same. I resorted to [AGSGeometryEngine projectGeometrytoSpatialReference] to create a new geometry with the map's SR. Works like a charm now. Many thanks.
... View more
03-20-2014
03:41 AM
|
0
|
0
|
449
|
POST
|
I've downloaded Esri's iOS GraphicsSample, the one with the segmented control and it's working just fine. It's very helpful specially with the callout feature implemented. I've looked through to compare the sample code with mine, there are hardly differences to notice but I'm suspicious over this line. self.mapView.layerDelegate = self; When I tried to copy it my app immediately responded with this warning. Assigning to 'id<AGSMapViewLayerDelegate>' from incompatible type 'ViewController_iPad *const __strong' Despite the warning I ran the app and I still get what I may call an invisible graphicsLayer, although I checked it's visibility is set to YES (true). I thought you should know this as well.
... View more
03-19-2014
06:49 AM
|
0
|
0
|
449
|
POST
|
FYI, I also tried applying a renderer for the whole graphics layer. Twice. (in the viewDidLoad of course after initialising the layer and before adding the layer to the mapView) First AGSFillSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol];
symbol.color = [UIColor redColor];
AGSSimpleRenderer* mySimpleRenderer = [AGSSimpleRenderer simpleRendererWithSymbol:symbol];
self.graphicsLayer.renderer = mySimpleRenderer;
Then AGSFillSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol];
symbol.color = [UIColor redColor];
AGSUniqueValueRenderer *cityRenderer = [[AGSUniqueValueRenderer alloc] init];
cityRenderer.defaultSymbol = symbol;
self.graphicsLayer.renderer = cityRenderer; And still nothing.
... View more
03-19-2014
05:09 AM
|
0
|
0
|
449
|
POST
|
1- After creating the basemap layer self.graphicsLayer = [AGSGraphicsLayer graphicsLayer]; [self.mapView addMapLayer:self.graphicsLayer withName:@"Graphics Layer"]; 2- I'm using GeoTrigger service and I call the "trigger/list" instruction. I use the code in the "Turn a trigger region into an AGSGeometry object" from this link https://developers.arcgis.com/geotrigger-service/guide/using-geotrigger-sdk-with-arcgis-runtime-sdk/#ios CLLocation *location = self.locations[0]; NSDictionary *params = @{@"geoFormat": @"esrijson", @"geo": @{@"latitude": @(location.coordinate.latitude), @"longitude": @(location.coordinate.longitude), @"distance": @100}}; [[AGSGTApiClient sharedClient] postPath:@"trigger/list" parameters:params success:^(id responseObject) { if (responseObject != nil) { NSArray *triggers = responseObject[@"triggers"]; for (NSDictionary *trigger in triggers) { NSDictionary *condition = trigger[@"condition"]; NSDictionary *geo = condition[@"geo"]; NSDictionary *esriJson = geo[@"esrijson"]; AGSGeometry *geometry = AGSGeometryWithJSONAndSR(esriJson, [self.mapView spatialReference]); // Do stuff with geometry! AGSFillSymbol* symbol = [AGSSimpleFillSymbol simpleFillSymbol]; symbol.color = [UIColor redColor]; //Create the AGSSimpleLineSymbol used for the outline AGSSimpleLineSymbol* myOutlineSymbol = [AGSSimpleLineSymbol simpleLineSymbol]; myOutlineSymbol.color = [UIColor redColor]; myOutlineSymbol.width = 2; //set the outline property to myOutlineSymbol symbol.outline = myOutlineSymbol; AGSGraphic *LocationDisplay = [[AGSGraphic alloc] initWithGeometry:geometry symbol:symbol attributes:nil]; [self.graphicsLayer addGraphic:LocationDisplay]; [self.graphicsLayer refresh]; [self.mapView zoomToGeometry:[LocationDisplay geometry] withPadding:0 animated:YES]; } } } failure:^(NSError *error) { NSLog(@"Error listing triggers: %@", error); }]; The codes zooms me to desired trigger area successfully, but it never shows the symbol for the graphic. I refer to the following link regarding graphics layers https://developers.arcgis.com/ios/guide/creating-a-graphics-layer.htm#ESRI_SECTION1_782802E7EF1E479C8FD6C29E5690ADA2 I've tried with a simpleFillSymbol, then with this outlineSymbol. I then tried using a TextSymbol instead, I even swiped away the whole basemap layer after zooming and still nothing shows from the graphicsLayer. What am I not doing right here?
... View more
03-19-2014
02:09 AM
|
0
|
4
|
2524
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|