Created
December 14, 2015 19:46
-
-
Save nitrag/5d790ca6079dc659c322 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NSArray *features = [geoJson valueForKey:@"features"]; | |
| NSMutableArray *tempArray = [[NSMutableArray alloc] init]; | |
| NSUInteger l = [features count]; | |
| NTGeoJSONGeometryReader* geoJsonReader = [[NTGeoJSONGeometryReader alloc] init]; | |
| for (int i=0; i<l; i++) { | |
| NSDictionary* feature = [features objectAtIndex:i]; | |
| NSDictionary *properties = [feature valueForKey:@"properties"]; | |
| if([properties valueForKey:@"color"] != nil ){ | |
| [lineStyleBuilder setColor:[[NTColor alloc] initWithColor:[self nColorConverter:[properties valueForKey:@"color"]]]]; | |
| }else{ | |
| [lineStyleBuilder setColor:[[NTColor alloc] initWithColor:[self nColorConverter:@""]]]; | |
| } | |
| NSDictionary *geometry = [feature valueForKey:@"geometry"]; | |
| NSData *geomData = [NSJSONSerialization dataWithJSONObject:geometry | |
| options:NSJSONWritingPrettyPrinted | |
| error:nil]; | |
| NSString* geomJson = [[NSString alloc] initWithData:geomData encoding:NSUTF8StringEncoding];; | |
| NTGeometry *geom = [geoJsonReader readGeometry:geomJson]; | |
| NTLine *lineElement = [[NTLine alloc] initWithGeometry:geom style:[lineStyleBuilder buildStyle]]; | |
| NSError * err; | |
| NSData * jsonData = [NSJSONSerialization dataWithJSONObject:properties options:0 error:&err]; | |
| NSString * myString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; | |
| [ lineElement setMetaDataElement:@"properties" element:myString]; | |
| [dataSource add:lineElement]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment