On Jun 30, 2:42 am, Fabrizio Bartolomucci <[email protected]> wrote: > Thanks Larry, > actually that is quite strange given the coordinates seem to move on the same > direction while the drawn polyline seem to also have a reverse path. I also > tried > to just print the first 100 dots, but they already featured that odd behavior.
I did the same thing Andrew did (after verifying that the data in your post exhibited the behavior): http://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=FabrizioBartolomucci_polyline.xml > As for the origin, the main points, in effect corresponding to the threading > of the > return path, are the positions of the bus stops of a bus line, and the points > in > between are the ones returned by google to connect them through roads. Seems like whoever added the bus stops put them in the wrong place. > Could you point me to the points producing that weird effect and/or to a web > site > where I may submit my points and have them drawn on a map without having to > mangle with the iOS app? I don't know of any tool to do that. I would have to go through the points manually. It would be easier to do with the original data. > > Greetings, Fabrizio > > Inviato da un mobile Fabrizio attraverso iPhone > > Il giorno 29/giu/2012, alle ore 23:15, "[email protected]" > <[email protected]> ha scritto: > > > > > > > > > On Jun 29, 11:55 am, Fabrizio Bartolomucci <[email protected]> > > wrote: > >> Hullo, > >> I would like to draw a polyline overlay over a map using values obtained by > >> google connecting some dots along the existing roads. Still while the > >> sequence I report here seems monotonouse, at least on the latitude side, > >> the polyline been drawn has a weird shape with one section along its full > >> lenght correctly following the roads, but with an apparent return part > >> going straighter and connecting random points near the correct ones as you > >> may see: > >> <http://miafoto.it/docs/IMG_0399.PNG> > > >> how do I get rid of them? > > > That is what the data you are putting in the polyline does. If you > > want to not have the line retrace like it is doing, you have to remove > > the extra points. > > > Where did this data come from? Why do you believe it shouldn't be > > doing that? > > > -- Larry > > >> This the code use: > > >> -(void) loadRoute:(Line*)myLine{ > > >> NSArray* pointStrings=[myLine getFullPath]; > > >> /* NSMutableArray *coordinatesArray=[[NSMutableArray alloc] init]; > > >> for(int i = 0; i < [pointStrings count]; i++) { > > >> [coordinatesArray > >> addObject:CLLocationCoordinate2DMake([pointStrings objectAtIndex:i].,p.y); > > >> } > > >> MKPolyline *polyLine = [MKPolyline > >> polylineWithCoordinates:pointStrings count:[pointStrings count]]; > > >> [myMapView addOverlay:polyLine];*/ > > >> // while we create the route points, we will also be calculating the > >> bounding box of our route > > >> // so we can easily zoom in on it. > > >> MKMapPoint northEastPoint; > > >> MKMapPoint southWestPoint; > > >> // create a c array of points. > > >> pointArr = malloc(sizeof(CLLocationCoordinate2D) * > >> pointStrings.count); > > >> for(int idx = 0; idx < pointStrings.count-1; idx++) > > >> { > > >> // break the string down even further to latitude and longitude > >> fields. > > >> NSString* currentPointString = [pointStrings objectAtIndex:idx]; > > >> NSArray* latLonArr = [currentPointString > >> componentsSeparatedByCharactersInSet:[NSCharacterSet > >> characterSetWithCharactersInString:@"|"]]; > > >> CLLocationDegrees latitude = [[latLonArr objectAtIndex:0] > >> doubleValue]; > > >> CLLocationDegrees longitude = [[latLonArr objectAtIndex:1] > >> doubleValue]; > > >> // create our coordinate and add it to the correct spot in the > >> array > > >> CLLocationCoordinate2D coordinate = > >> CLLocationCoordinate2DMake(latitude, longitude); > > >> NSLog(@"%f, %f", latitude,longitude); > > >> MKMapPoint point = MKMapPointForCoordinate(coordinate); > > >> // > > >> // adjust the bounding box > > >> // > > >> // if it is the first point, just use them, since we have > >> nothing to compare to yet. > > >> if (idx == 0) { > > >> northEastPoint = point; > > >> southWestPoint = point; > > >> } > > >> else > > >> { > > >> if (point.x > northEastPoint.x) > > >> northEastPoint.x = point.x; > > >> if(point.y > northEastPoint.y) > > >> northEastPoint.y = point.y; > > >> if (point.x < southWestPoint.x) > > >> southWestPoint.x = point.x; > > >> if (point.y < southWestPoint.y) > > >> southWestPoint.y = point.y; > > >> } > > >> pointArr[idx] = point; > > >> } > > >> // create the polyline based on the array of points. > > >> self.routeLine = [MKPolyline polylineWithPoints:pointArr > >> count:pointStrings.count-1]; > > >> _routeRect = MKMapRectMake(southWestPoint.x, southWestPoint.y, > >> northEastPoint.x - southWestPoint.x, northEastPoint.y - southWestPoint.y); > > >> // clear the memory allocated earlier for the points > > >> free(pointArr); > > >> if (nil != self.routeLine) { > > >> [myMapView addOverlay:self.routeLine]; > > >> } > > >> } > > >> And the sequence of values that should generate the polyline:: > > >> 2012-06-29 17:16:27.947 inArrivo[6293:707] 41.702019, 12.345350 > > >> 2012-06-29 17:16:27.949 inArrivo[6293:707] 41.702209, 12.344930 > > >> 2012-06-29 17:16:27.951 inArrivo[6293:707] 41.702579, 12.344140 > > >> 2012-06-29 17:16:27.952 inArrivo[6293:707] 41.702770, 12.343740 > > >> 2012-06-29 17:16:27.954 inArrivo[6293:707] 41.702808, 12.343660 > > >> 2012-06-29 17:16:27.955 inArrivo[6293:707] 41.702888, 12.343480 > > >> 2012-06-29 17:16:27.956 inArrivo[6293:707] 41.703011, 12.343230 > > >> 2012-06-29 17:16:27.958 inArrivo[6293:707] 41.703091, 12.343070 > > >> 2012-06-29 17:16:27.960 inArrivo[6293:707] 41.703178, 12.342860 > > >> 2012-06-29 17:16:27.962 inArrivo[6293:707] 41.703289, 12.342620 > > >> 2012-06-29 17:16:27.964 inArrivo[6293:707] 41.703350, 12.342500 > > >> 2012-06-29 17:16:27.965 inArrivo[6293:707] 41.703480, 12.342230 > > >> 2012-06-29 17:16:27.967 inArrivo[6293:707] 41.703541, 12.342110 > > >> 2012-06-29 17:16:27.968 inArrivo[6293:707] 41.703732, 12.341690 > > >> 2012-06-29 17:16:27.970 inArrivo[6293:707] 41.704021, 12.341090 > > >> 2012-06-29 17:16:27.971 inArrivo[6293:707] 41.704182, 12.340750 > > >> 2012-06-29 17:16:27.974 inArrivo[6293:707] 41.704330, 12.340410 > > >> 2012-06-29 17:16:27.975 inArrivo[6293:707] 41.704460, 12.340150 > > >> 2012-06-29 17:16:27.977 inArrivo[6293:707] 41.702019, 12.345350 > > >> 2012-06-29 17:16:27.979 inArrivo[6293:707] 41.703178, 12.342860 > > >> 2012-06-29 17:16:27.980 inArrivo[6293:707] 41.703541, 12.342110 > > >> 2012-06-29 17:16:27.981 inArrivo[6293:707] 41.704330, 12.340410 > > >> 2012-06-29 17:16:27.982 inArrivo[6293:707] 41.704460, 12.340150 > > >> 2012-06-29 17:16:27.987 inArrivo[6293:707] 41.704460, 12.340150 > > >> 2012-06-29 17:16:27.989 inArrivo[6293:707] 41.704540, 12.339970 > > >> 2012-06-29 17:16:27.990 inArrivo[6293:707] 41.705132, 12.338720 > > >> 2012-06-29 17:16:27.992 inArrivo[6293:707] 41.705429, 12.338080 > > >> 2012-06-29 17:16:27.994 inArrivo[6293:707] 41.705608, 12.337690 > > >> 2012-06-29 17:16:27.996 inArrivo[6293:707] 41.705799, 12.337300 > > >> 2012-06-29 17:16:27.997 inArrivo[6293:707] 41.705860, 12.337150 > > >> 2012-06-29 17:16:27.999 inArrivo[6293:707] 41.706200, 12.336340 > > >> 2012-06-29 17:16:28.000 inArrivo[6293:707] 41.706299, 12.336120 > > >> 2012-06-29 17:16:28.002 inArrivo[6293:707] 41.707199, 12.333980 > > >> 2012-06-29 17:16:28.003 inArrivo[6293:707] 41.707661, 12.333100 > > >> 2012-06-29 17:16:28.005 inArrivo[6293:707] 41.707741, 12.332960 > > >> 2012-06-29 17:16:28.006 inArrivo[6293:707] 41.707920, 12.332620 > > >> 2012-06-29 17:16:28.008 inArrivo[6293:707] 41.708000, 12.332440 > > >> 2012-06-29 17:16:28.009 inArrivo[6293:707] 41.704460, 12.340150 > > >> 2012-06-29 17:16:28.019 inArrivo[6293:707] 41.705608, 12.337690 > > >> 2012-06-29 17:16:28.020 inArrivo[6293:707] 41.705860, 12.337150 > > >> 2012-06-29 17:16:28.022 inArrivo[6293:707] 41.706299, 12.336120 > > >> 2012-06-29 17:16:28.023 inArrivo[6293:707] 41.707199, 12.333980 > > >> 2012-06-29 17:16:28.024 inArrivo[6293:707] 41.707661, 12.333100 > > >> 2012-06-29 17:16:28.025 inArrivo[6293:707] 41.707920, 12.332620 > > >> 2012-06-29 17:16:28.035 inArrivo[6293:707] 41.708000, 12.332440 > > >> 2012-06-29 17:16:28.036 inArrivo[6293:707] 41.708031, 12.332370 > > >> 2012-06-29 17:16:28.038 inArrivo[6293:707] 41.708118, 12.332170 > > >> 2012-06-29 17:16:28.040 inArrivo[6293:707] 41.708260, 12.331910 > > >> 2012-06-29 17:16:28.041 inArrivo[6293:707] 41.708462, 12.331500 > > >> 2012-06-29 17:16:28.043 inArrivo[6293:707] 41.708542, 12.331350 > > >> 2012-06-29 17:16:28.045 inArrivo[6293:707] 41.708752, 12.330870 > > >> 2012-06-29 17:16:28.047 inArrivo[6293:707] 41.708889, 12.330580 > > >> 2012-06-29 17:16:28.048 inArrivo[6293:707] 41.709030, 12.330290 > > >> 2012-06-29 17:16:28.050 inArrivo[6293:707] 41.709179, 12.329980 > > >> 2012-06-29 17:16:28.064 inArrivo[6293:707] 41.709320, 12.329660 > > >> 2012-06-29 17:16:28.065 inArrivo[6293:707] 41.709381, 12.329520 > > >> 2012-06-29 17:16:28.067 inArrivo[6293:707] 41.709469, 12.329330 > > >> 2012-06-29 17:16:28.068 inArrivo[6293:707] 41.709599, 12.329060 > > >> 2012-06-29 17:16:28.069 inArrivo[6293:707] 41.709728, 12.328790 > > >> 2012-06-29 17:16:28.070 inArrivo[6293:707] 41.709881, 12.328490 > > >> 2012-06-29 17:16:28.085 inArrivo[6293:707] 41.709991, 12.328210 > > >> 2012-06-29 17:16:28.086 inArrivo[6293:707] 41.708031, 12.332370 > > >> 2012-06-29 17:16:28.088 inArrivo[6293:707] 41.708542, 12.331350 > > >> 2012-06-29 17:16:28.089 inArrivo[6293:707] 41.708889, 12.330580 > > >> 2012-06-29 17:16:28.090 inArrivo[6293:707] 41.709179, 12.329980 > > >> 2012-06-29 17:16:28.091 inArrivo[6293:707] 41.709599, > > ... > > read more » -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
