2

I would like to color (fill and/or stroke) a country boundaries (boarders), say you have a world map and the user picked Italy, the boarders of italy will be stroked and the area of Italy will be filled with a color.

enter image description here

It would be very nice if the user can zoom and move the global map, but not a must. I am looking for something clean, dynamic , iOS5 friendly and easy to integrate, can be mapKit based or not.

I am aware that this can be done by KML files, but I am rather sure there is a library already out there - so there is no need of me reinventing fire, again.

chewy
  • 8,207
  • 6
  • 42
  • 70

1 Answers1

5

I've done this, but it's a little tricky. You have to get all the coordinates for the boundary: i used this tool to get all the coordinates of my boudary, you have to use the polyline tool and each time you click on the map this tool generates all the coordinates on the right. Once you have all the coordinates, save them in some txt or klm file, then use MKOverlay class to draw the overlay based on the file's coordinates.

Hope it's clear, let me know if you want the snippet(i don't have my machine now).

Mat
  • 7,613
  • 4
  • 40
  • 56
  • yep, I already started doing so, got all the coordinates but still having some hard time fiddling with the polygons. I assume I am going to post another question (with solution) later on. still I find it hard to believe that there is no free library that do so, thus I am keeping this question open, if its all the same to you. – chewy Nov 23 '11 at 11:53
  • 1
    "still I find it hard to believe that there is no free library"..mee too!..I think, more than a library, you should find a database that already knows all the coordinates of the boundaries of all countries. For example, you ask them "Italy" and will return a very specific set of coordinates..if you find something like this, please let me know! – Mat Nov 23 '11 at 13:04
  • did you figure out this? have you post the solution in a separate post ? – Mouhamad Lamaa Mar 04 '13 at 08:04
  • I guess it's been a few years since the original posting, but I'm not finding any libraries out there either. Specifically, I'm trying to generate choropleth overlays -- so map coloring but a specific application. So time to invent the library, I guess. – ultrageek Jan 19 '15 at 00:36
  • Link for this tool updated for Google Map API v3 http://www.birdtheme.org/useful/v3tool.html – CodeBrew Oct 11 '20 at 14:43