|
POST
|
I have a tableView that holds an array of records that correspond with AGSGraphics which are in a mapView. The tableView and mapView are separate views. The goal here is to allow the user to tap the tableView's accessoryButton then the view changes to the mapView and a callout for the corresponding AGSGraphic shows. I can step through the code until I get to the first method in the infoTemplateDelegate. It is here that the Xcode gives the error message: "CALayer position contains NaN: [nan nan]". I am listing the code below in the order that it is stepped through. I have two graphics layers - one that holds the graphics on the map (myGraphicsLayer) and another that is used to show the callout (popupGraphicsLayer). This seems odd so perhaps this is where I have messed up. pointsTableController.m - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:
(NSIndexPath *)indexPath {
GPS1AppDelegate *delegate = (GPS1AppDelegate *)[[UIApplication sharedApplication] delegate];
mapViewController = [[MapView alloc] init];
[delegate.navController pushViewController:mapViewController animated:YES];
NSUInteger matchingObjectID;
for ( NSMutableDictionary *dict1 in pointRows )
{
if ( [[dict1 valueForKey:@"dict_objectid"] isEqual:
[[pointRows objectAtIndex:indexPath.row] valueForKey:@"dict_objectid"]] )
{
matchingObjectID = [[dict1 valueForKey:@"dict_objectid"] intValue];
}
}
[mapViewController selectThePoint:matchingObjectID];
} MapView.m -(void)selectThePoint:(NSUInteger)objectID
{
self.popupGraphicsLayer = [AGSGraphicsLayer graphicsLayer];
[self.mapView addMapLayer:self.popupGraphicsLayer withName:@"Popup Layer"];
AGSGraphic *foundAGSGraphic;
foundAGSGraphic = [[AGSGraphic alloc] init];
for ( AGSGraphic *graphicItem in self.myGraphicsLayer.graphics )
{
if ( [[graphicItem.attributes valueForKey:@"dict_objectid"] intValue] == objectID )
{
foundAGSGraphic = graphicItem;
}
}
[self.popupGraphicsLayer addGraphic:foundAGSGraphic];
[self.popupGraphicsLayer dataChanged];
[self.mapView showCalloutAtPoint:nil forGraphic:foundAGSGraphic animated:YES];
} infoTemplateDelegate.m
@implementation infoTemplateDelegate
-(NSString *)titleForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)map
{
// when this is called from selectThePoint, Xcode returns
// "CALayer position contains NaN: [nan nan]" when
// the next line is stepped through.
return [graphic.attributes valueForKey:@"dict_point_number"];
}
-(NSString *)detailForGraphic:(AGSGraphic *)graphic screenPoint:(CGPoint)screen mapPoint:(AGSPoint *)map
{
return [graphic.attributes valueForKey:@"dict_comment"];
}
@end Thanks for any help, Paul Lohr
... View more
12-04-2011
12:46 AM
|
0
|
1
|
2324
|
|
POST
|
Thank you for your help, Nimesh. I may ask later for an example of how this might be done in code. For now I am using a callout. The callout should work since I only need one callout at a time. I will post a new thread about the callout since I have not been able to get it working.
... View more
12-04-2011
12:19 AM
|
0
|
0
|
1515
|
|
POST
|
When showing callouts programmatically, it might make sense to show more than one callout. Unless there is a way to show multiple features highlighted at the same time - that could be a workaround if this idea is already in place. I don't know if there is a way to highlight features. Here is one case that might be worth considering. We have a tableView on one page. We have a mapView on the other page. The tableView contains records that correspond to graphics on the mapView. The user selects multiple records in the tableView then switches to the mapView to see the corresponding graphics either with callouts or the graphics are highlighted.
... View more
12-02-2011
02:29 AM
|
0
|
0
|
1515
|
|
POST
|
I have a bit of code that does the following. Push an AGSGraphic into an array. Push each AGSGraphic item from the array into an AGSGraphicsLayer. I have a tableView whose cells correspond with the AGSGraphics shown on the map. After I tap the point to get the callout, I would like to tap the accessoryButton which calls the tableView with the related cell highlighted. The problem is establishing a relationship between the AGSGraphics and the UITableView cells. I am looking for a way to uniquely identify an AGSGraphic, preferably the same way array items are identified. I would think AGSGraphicsLayer holds an array of AGSGraphics. Perhaps there is a way similar to [array1 objectAtIndex:indexPath.row]; which can be used against an AGSGraphicsLayer? A statement such as this one would have to be called in mapView:didClickCalloutAccessoryButtonForGraphic (I assume). Thanks for any help, Paul Lohr
... View more
11-15-2011
08:37 AM
|
0
|
2
|
766
|
|
POST
|
I thought that was a good idea also. You would have to reconstruct something similar to the ArcGIS for iOS App. ESRI gives you the API, documentation, and sample code to get you started.
... View more
11-10-2011
05:06 AM
|
0
|
0
|
297
|
|
POST
|
I am still new to this - maybe it is a chance for me to learn. I could be all wrong on this, Jeremy. The way I understand how ESRI separates class properties and instance variables is like this: <mapView> - class property <_mapView> - instance variable. This can be seen in the synthesize statement and the header file. Usually I setup and use the property like this: [self.mapView goDoSomething]; In your example, it looks like you may have alloc/init'd a method variable while you probably also have a class property and instance variable available for use. This assumes you use the ESRI convention of setting up all of these in your header file and synthesize statement.
... View more
10-31-2011
04:03 AM
|
0
|
0
|
366
|
|
POST
|
Did you remember to add the gif file to your Xcode project?
... View more
10-27-2011
07:56 AM
|
0
|
0
|
461
|
|
POST
|
You are on the right track - ArcGIS Server is needed to do out of the box data collection on your iPad (unless you decide to write code against the iOS sdk). Maybe look at something like iGIS? Paul Lohr
... View more
10-27-2011
07:52 AM
|
0
|
0
|
370
|
|
POST
|
Using Windows Explorer, browse to a location where your ArcGIS Server installation is located, then to where the service configuration files are stored. Usually this is something like: C:\Program Files\ArcGIS\Server10.0\server\user\cfg\<folderName_or_serviceName> Find the CFG file for the service you'd like to modify. Open the CFG with a text editor, change MaxRecordCount to whatever value you like, save and close the file. Restart the service, you are good to go.
... View more
10-26-2011
09:43 AM
|
0
|
0
|
1133
|
|
POST
|
Byron, I've seen this question come up a lot. The ArcGIS for iOS app is intended to work over the 3G or wifi connection. I think it is pretty much disabled without the connection. If you decide to build applications with the ArcGIS SDK, it is possible to operate without a connection. There are code samples to get you started.
... View more
10-24-2011
11:12 AM
|
0
|
0
|
421
|
|
POST
|
I wonder if an error message would be returned if wtkNAN83HARNWashintongNort was not created properly...? The first layer that gets added to your map, does it match the wtkNAN83HARNWashintongNort projection? If not you might try making sure they match just as a test.
... View more
10-20-2011
11:32 AM
|
0
|
0
|
546
|
|
POST
|
Usually right after a new release becomes available, responses from ESRI are a little on the thin side. I suspect they are working diligently to resolve a few issues. If you can wait a bit, the resolution will probably come shortly. Sorry I could not be of more help. Paul Lohr
... View more
10-17-2011
03:19 PM
|
0
|
0
|
339
|
|
POST
|
With some help, I found that AGSGraphics showing up at 0,0 is usually caused by a mismatch of coordinate systems. If your first added map layer (I call it the base or background layer) is in WGS84, then your overlaid AGSGraphics need to be in WGS84. The other way to handle the mismatch is convert the data to match the map's coordinate system. Like this: AGSGeometry *myPointReprojected;
AGSGeometryEngine *ge = [AGSGeometryEngine defaultGeometryEngine];
myPointReprojected = [ge projectGeometry:myPoint toSpatialReference:
[AGSSpatialReference webMercatorSpatialReference]]; Note that myPoint was instantiated by the AGSPoint class.
... View more
10-07-2011
03:10 AM
|
0
|
0
|
386
|
|
POST
|
I have a problem with the way I've setup the pushing of attributes into an AGSGraphic. Here is what I am doing:
NSMutableArray *myGraphicArray = [[NSMutableArray alloc] init];
// myMarkerPointArray is an NSMutableArray of AGSPoint objects.
for ( AGSPoint *item in myMarkerPointArray )
{
// textFileMgmt1.points contains an NSMutableArray containing three NSMutableDictionaries
of attributes
for ( NSMutableDictionary *itemDictionary in textFileMgmt1.points )
{
AGSGraphic *myGraphic = [[AGSGraphic alloc] initWithGeometry:item
symbol:myMarkerSymbol
attributes:itemDictionary
infoTemplateDelegate:self.template];
[myGraphicArray addObject:myGraphic];
[myGraphic release];
}
} The result of this code is each AGSPoint gets assigned attributes three times (currently there are three objects in myMarkerPointArray). Of course the attributes should only be assigned once. Being that I have to parse two arrays at once and I'm an amateur, I don't know how to handle this. I looked for a solution in the GraphicsDemo sample but did not find anything. Thank you for any help, Paul Lohr
... View more
10-06-2011
03:28 AM
|
0
|
0
|
2912
|
|
POST
|
On your arcgis server installation, go to the place where your arcgis mobile content is published. By default, I think this is \inetpub\wwwroot\ArcGIS\Mobile\ItemsRoot\<map_id>. In the folder named <map_id> you should have a text file with the JSON content. Does this answer your question?
... View more
10-03-2011
02:43 AM
|
0
|
0
|
574
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-28-2025 01:39 PM | |
| 1 | 06-20-2025 07:01 AM | |
| 1 | 07-18-2024 10:19 AM | |
| 1 | 09-13-2024 05:27 AM | |
| 1 | 09-12-2024 12:27 PM |
| Online Status |
Online
|
| Date Last Visited |
5 hours ago
|