0

I want to draw a route from east to west in my iOS app: for example from Asia to America. The problem is I want the route drawed on the pacific ocean, and not from asia to europa to america...

the problem is that from the most east point to the most west point, there is an horizontal line... really really ugly :(

Do you know how to solve it?

I took the code here

Thanks

JAA
  • 1,024
  • 3
  • 20
  • 34
  • 1
    See if [this answer](http://stackoverflow.com/questions/5840548/unable-to-draw-mkpolylineview-crossing-longitude-180) helps. –  Jul 11 '11 at 15:11

2 Answers2

0

I would need to see a screenshot to be sure but I think that is a limitation of the underlying maps.

Rog
  • 17,070
  • 9
  • 50
  • 73
  • sure! www.giacomosaccardo.com/draw.png the line in the bottom is my route, the upper line is the horizontal line created automatically – JAA Jul 11 '11 at 15:07
0

I haven't played with drawing routes in iOS but I solved the same problem in OpenLayers by drawing two routes. One as if the world went from 0 to 360 and one as it it went from 0 to -360. So if Japan is about (134,34) and SanFran is about (-122,37) you'd draw lines between these points

(134,34) to (238, 37) (-226,34) to (-122,37)

Like I said, untested in iOS but it won't take you very long to see if I'm right.

Craig
  • 8,093
  • 8
  • 42
  • 74
  • thanks, but my route is dynamic... and "break" it dynamically is a quite complex. – JAA Jul 12 '11 at 20:52
  • Are you sure it's that hard? I'd just take the difference between the latitudes, then the relative distances to the antimeridian (say it's 40% on the left of the line and 60% to the right) then the point at which the path crosses the antimeridian would be 40% of the way from left to right in longitude and latitude too. Of course this could be thrown off by the fact we're on a sphere not a cylinder, but I don't see any other options popping up. – Craig Jul 23 '11 at 02:51