我正在嘗試在我的應用程序應用程序的圖形層上繪製路線,而我不知道這是正確的做法還是另一個如何做到這一點?我在哪裏試圖使用NSArray和ArgGIS來繪製地圖,我有問題。在'MapViewController *'類型的對象上未找到屬性'jsonData'
*編輯我試圖改變的NSArray回JSON字符串,並嘗試使用ArcGIS與JSON字符串
這它來畫是我做了什麼:
NSArray *BusRoute=[jsonResult objectForKey:@"BusRoute"];
int i;
int count = [BusRoute count];
for (i = 0; i < count; i++)
{
NSDictionary *dic = [BusRoute objectAtIndex: i];
NSString *Duration = [dic valueForKey:@"Duration"];
//---PATH---
NSArray *PATH = [dic valueForKey:@"PATH"];
NSLog(@"PATH = %@", PATH);
self.path = PATH;
}
NSError *writeError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:path options:NSJSONWritingPrettyPrinted error:&writeError];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"JSON Output: %@", jsonString);
if (self.jsonString) {
// symbolize the returned route graphic
self.jsonString.routeGraphic.symbol = [self routeSymbol];
// add the route graphic to the graphic's layer
[self._graphicsLayer addGraphic:self.jsonString.routeGraphic];
// tell the graphics layer to redraw
[self._graphicsLayer dataChanged];
}
*爲JSON輸出串
JSON Output: [
[
"38909,35576;38872,35589;38861,35593;38848,35597;38697,35650;38695,35651;38695,35651;38609,35681;38583,35689;38553,35697;38508,35700;38476...;29560,40043"
]
]
這是我必須在地圖上繪製的路徑的一部分:
PATH = (( "38909,35576;38872,35589;38861,35593;38848,35597;38697,35650;38695,35651;38695,35651;38609,35681;38583,35689;38553,35697;38508,35700;38476,35696;38476,35696;....))
此行self.jsonData.routeGraphic.symbol = [self routeSymbol];
我得到一個錯誤Property 'Property 'jsonData' not found on object of type 'MapViewController *'
應該怎麼做什麼來解決?請幫助
*怎樣繪製使用NSArray
和使用ArcGIS路徑的線?
有沒有一種方法可以在圖形圖層上使用'NSArray'和'ArcGIS'繪製路徑? – sihao 2012-08-06 01:23:14
重新編輯整個qn – sihao 2012-08-08 09:35:47