I’m trying to plot and area on a map with multiple GPS coordinates. These coordinates will be downloaded from a web service. There are five coordinates that creates on colored area block. since I can’t post images yet here is a url to the example
OutageMap
Can someone tell me what the best way of achieving this? I’m shooting in the dark here so no real code is available. The below url is what we currently use via html. Trying to create it natively to iphone instead of calling a webview.
You can use a
MKPolygonand aMKPolygonViewwith your list of points:When the viewController is created, or the data is loaded, you add a
MKPolygonfor each colored block to the map:Then you add a
mapView:viewForOverlaymethod to draw each polygon:This will draw a green box for each of your polygons. In order to have each polygon be a certain color I would create a
ColoredPolygonclass that is a subclass ofMKPolygonand that has acolorproperty. You then createColoredPolygonand set the color when loading the data. InmapView:viewForOverlayyou would just cast theMKOverlayto aColoredPolygonand then set thefillColortoColoredPolygon.color.