On Jun 30, 9:40 am, "[email protected]" <[email protected]>
wrote:
> On Jun 30, 9:27 am, Fabrizio Bartolomucci <[email protected]> wrote:
> > Il giorno 30/giu/2012, alle ore 17:50, [email protected] ha scritto:
>
> > > 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=FabrizioB...
>
> > Yes, of course: the data had duplications. Thanks anyway for the 
> > confirmation testifying the rather weird aspect of the duplications...
>
> > >> 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.
>
> > To the reverse: as you may see in the original url I 
> > submitted:http://www.miafoto.it/iPhone/inarrivo/php/paletteForLineWithRoute.php...
> > The latitudes for the bus stops along with their names are correct and 
> > distinct. It is the google algorithm joining them to apparently create the 
> > duplications in each leg.
>
> > >> 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.
>
> > The data are inside the xml result in the latitude, longitude tags, while 
> > the coordinates returned by google are inserted into the legLatitude and 
> > legLongitude tags, of course in the source of the page.
>
> > You may try and join the first two coordinates retuned by the url:
> > <latitude>41.658935</latitude><longitude>12.422408</longitude>
> > <latitude>41.665596</latitude><longitude>12.404847</longitude>
> > through the google direction service to see what is returns, if that is 
> > different from what I get: namely:
> > <path><leg><legLatitude>41.65886</legLatitude><legLongitude>12.4223</legLon 
> > gitude></leg><leg><legLatitude>41.6592</legLatitude><legLongitude>12.42188< 
> > /legLongitude></leg><leg><legLatitude>41.65947</legLatitude><legLongitude>1 
> > 2.42155</legLongitude></leg><leg><legLatitude>41.65948</legLatitude><legLon 
> > gitude>12.42147</legLongitude></leg><leg><legLatitude>41.65957</legLatitude 
> > ><legLongitude>12.42136</legLongitude></leg><leg><legLatitude>41.65957</leg 
> > Latitude><legLongitude>12.42136</legLongitude></leg><leg><legLatitude>41.65 
> > 913</legLatitude><legLongitude>12.42066</legLongitude></leg><leg><legLatitu 
> > de>41.65901</legLatitude><legLongitude>12.42046</legLongitude></leg><leg><l 
> > egLatitude>41.65883</legLatitude><legLongitude>12.42018</legLongitude></leg 
> > ><leg><legLatitude>41.65843</legLatitude><legLongitude>12.41957</legLongitu 
> > de></leg><leg><legLatitude>41.6583</legLatitude><legLongitude>12.41936</leg 
> > Longitude></leg><leg><legLatitude>41.65822</legLatitude><legLongitude>12.41 
> > 92</legLongitude></leg><leg><legLatitude>41.65814</legLatitude><legLongitud 
> > e>12.41907</legLongitude></leg><leg><legLatitude>41.65745</legLatitude><leg 
> > Longitude>12.41811</legLongitude></leg><leg><legLatitude>41.65695</legLatit 
> > ude><legLongitude>12.41748</legLongitude></leg><leg><legLatitude>41.65677</ 
> > legLatitude><legLongitude>12.41725</legLongitude></leg><leg><legLatitude>41 
> > .65668</legLatitude><legLongitude>12.41713</legLongitude></leg><leg><legLat 
> > itude>41.65668</legLatitude><legLongitude>12.41713</legLongitude></leg><leg 
> > ><legLatitude>41.65679</legLatitude><legLongitude>12.41699</legLongitude></ 
> > leg><leg><legLatitude>41.6569</legLatitude><legLongitude>12.41685</legLongi 
> > tude></leg><leg><legLatitude>41.65719</legLatitude><legLongitude>12.4164</l 
> > egLongitude></leg><leg><legLatitude>41.65735</legLatitude><legLongitude>12. 
> > 41616</legLongitude></leg><leg><legLatitude>41.65789</legLatitude><legLongi 
> > tude>12.41538</legLongitude></leg><leg><legLatitude>41.65799</legLatitude>< 
> > legLongitude>12.41523</legLongitude></leg><leg><legLatitude>41.65801</legLa 
> > titude><legLongitude>12.4152</legLongitude></leg><leg><legLatitude>41.65861 
> > </legLatitude><legLongitude>12.41431</legLongitude></leg><leg><legLatitude> 
> > 41.65886</legLatitude><legLongitude>12.4223</legLongitude></leg><leg><legLa 
> > titude>41.65947</legLatitude><legLongitude>12.42155</legLongitude></leg><le 
> > g><legLatitude>41.65948</legLatitude><legLongitude>12.42147</legLongitude>< 
> > /leg><leg><legLatitude>41.65957</legLatitude><legLongitude>12.42136</legLon 
> > gitude></leg><leg><legLatitude>41.65901</legLatitude><legLongitude>12.42046 
> > </legLongitude></leg><leg><legLatitude>41.65843</legLatitude><legLongitude> 
> > 12.41957</legLongitude></leg><leg><legLatitude>41.65822</legLatitude><legLo 
> > ngitude>12.4192</legLongitude></leg><leg><legLatitude>41.65745</legLatitude 
> > ><legLongitude>12.41811</legLongitude></leg><leg><legLatitude>41.65677</leg 
> > Latitude><legLongitude>12.41725</legLongitude></leg><leg><legLatitude>41.65 
> > 668</legLatitude><legLongitude>12.41713</legLongitude></leg><leg><legLatitu 
> > de>41.65679</legLatitude><legLongitude>12.41699</legLongitude></leg><leg><l 
> > egLatitude>41.65719</legLatitude><legLongitude>12.4164</legLongitude></leg> 
> > <leg><legLatitude>41.65789</legLatitude><legLongitude>12.41538</legLongitud 
> > e></leg><leg><legLatitude>41.65861</legLatitude><legLongitude>12.41431</leg 
> > Longitude></leg></path>
> > with quite a large number of duplicates.
>
> Sounds like you are doing the wrong thing with the data.  Why are you
> including the source points as well as the leg points?  Or did I
> misunderstand?

Here is your data with the points in the order specified in the list
(which is not the order you want):
http://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=FabrizioBartolomucci_polyline_markers.xml

   -- Larry


>
>
>
>
>
>
>
> > Greetings, Fabrizio
>
> > >> 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)
>
> ...
>
> 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.

Reply via email to