Finding Sites
I’ve included a button for Search Sites on this screen, so now you can search for sites to plan your activation/s without going into one of the add data screens. One change I’ve made to Search Sites is to allow the user to add a new site and then use it wherever the Site ID is used.
I’ve also added a Map function. I’ve had heaps of fun developing the map function and it integrates with the Sites data by longitude/latitude.
How did I get those pins to automatically appear on the map?
There is a Sites table in the database on the iPhone/iPad. The database is installed with the app and includes a list of Sites from ParksnPeaks.org. Most Sites have a longitude & latitude reference.
When the user presses the Show Map button, the list is passed to the map background code and then each site is hooked up using their longitude/latitude reference. Apple’s mapping framework creates the pins. I’ve had experience with GPS and mapping before, so that helped. Note that I’ve chosen to display only 5 sites on the map which is why the map doesn’t show all but you can change it in Settings.
Showing Sites around a selected site
I’ve made a change to allow operators to search for a site, then show all sites around it within their selected radius. This means you can plan your trip to a site from the comfort of your home and see all the parks & summits around it that you could also activate.
In the screenshots below, I used Search Sites to find Mt Lofty in the Adelaide Hills. I then wanted to see every park or summit within a 12km radius of Mt Lofty, press the Show button. The list is in descending order by distance. The app treats your current location as Mt Lofty and shows the distances from there. Then I displayed 5 of them on the Map and further down the page, you’ll see what information you can view at each pin. Please note, I recently added the Shire code to this information, when I discovered that many Shires were missing from the data, I took a different route and used Allen’s API to get the Shire based on the longitude/latitude.
When you select just one site from your list and press Show Map, you’ll see the Show Route button. When you press the button, it will draw a line between your current location and the selected site. This was all done in code. Fortunately, Apple has provided us with a rich framework of properties and methods that I can use to deal with maps.