0

I got .plist file from client which have addresses and their latitude and longitude.

My requirement is, when I scroll mapview respective latitude and longitude would be updated and show proper location on map.

e.g. Suppose I have current location on map is New york and I drop a pin in new york. Now when I scroll my mapview to new jersey and if the latitude and longitude match with .plist file's latitude and longitude then the pin should be drop on new jersey location.

requesting you to provide soulution because this is a big block for me in my application.

iPhone
  • 4,092
  • 3
  • 34
  • 58

2 Answers2

0

First, you have to parse your plist and store the latlong in a dictionary. Every time the map moves (map delegate methods e.g. mapDidMove will be called), loop in you dictionary and check whether the latlon is visible.

Xchord
  • 678
  • 1
  • 5
  • 20
0
  1. find map view is scrolled refer determine if MKMapView was dragged/moved
  2. if map view is scrolled then get map view(visible) area bounds in latitude and longitude refer Getting the bounds of an MKMapvIew
  3. compare your pins locations if any falls in this region. if so add pin to map

Home this helps

Community
  • 1
  • 1
naresh
  • 627
  • 1
  • 7
  • 28
  • even you can add all pins to map if you have few pins to show. – naresh Aug 04 '15 at 09:33
  • Thanks for reply but how can I check whether my pin locations fall in the visible region? How can I compare locations? – iPhone Aug 04 '15 at 09:46
  • please check http://stackoverflow.com/questions/2752725/finding-whether-a-point-lies-inside-a-rectangle-or-not – naresh Aug 04 '15 at 09:55
  • nares, that's not a good answer, as the rectangle is in a 2D plane, you are on the surface of a sphere (the Earth). Doesn't work as an approximation either. – StefanS Aug 04 '15 at 10:40
  • here rectangle is made with GPS co ordinates. means we are comparing same quantities. you can suggest if you have any better answer. – naresh Aug 04 '15 at 10:52