October 27, 2014

App Development: Comparing Mapping API's

In the development of any mapping application for mobile, there are considerations for a multitude of APIs with varying levels of service, rate limits, data quality, hardware integration, performance, etc. A little up-front research greatly reduce the amount of trial-and-error you may encounter in development.

Here we took a surface-level view at various APIs for the development of a multiple-destination routing application. The user would enter a route, and select 'on-the'way' restaurants, businesses, landmarks, points of interest, etc. The application would be designed for exclusively for iOS.

 
Mock-up of proposed routing application.

Both mapping and review APIs (business ratings) were of interest for this particular app. There are several considerations:


1. Use native application or alternative?


After an initial debacle in 2013, Apple has improved its mapping services. New imagery and data is being uploaded daily and Yelp reviews are now integrated into the app. Being the native map application, it does have fast performance. Despite this, there are still some issues with routing and you can’t create multiple destinations making it irrelevant right now for an ‘on-the-way’ app, at least without including some external libraries.


2. Multiple-destination routing. 

While most services provide driving and walking directions, several major map APIs are designed for single-destination routes. Realistically, when I used a personal routing service I often want to see if I can get gas or stop for coffee, beyond just getting from point A to point B. Nokia Here, as well as Apple Maps have this single-destination limitation and would need a work-around for additional destinations.

(Edit: With this particular app you could simply code a combination of separate routes to multiple destinations. Still, it is a useful indicator of the level of performance with more advanced routing APIs.)

3. Proprietary versus Open.

Google certainly stands out as the ideal platform to build on. It is an all-in-one solution and a programmers dream. However, Google has strict control over design and can potentially get costly down the road. In my opinion, Bing, Nokia Here, and Yahoo simply don’t compare in terms of data, services, or users and all seem to be struggling to revamp and compete. An open-source combination is a viable option, however,  giving the power of advanced routing APIs like MapQuest that use the extremely detailed and current OpenStreetMap at little or no cost.


MapQuest advanced routing services provide 
multiple destinations and driving directions.

4. Usage.

What are your realistic potential users per day? Yelp and open-source frameworks are a good option if you are below the 25k transactions-per-day cap. If you're above, try a Google-based solution. If you have more than 10 million users go with the premium Cloudmade service!



3. Review focus.

Are you interested in all locations, just businesses, or restaurants and convenience stops? Yelp has a top-tier database for the latter. Google Places arguably has a broader range and you verify your account, usage limits on the API are 100k per day.







Option A:

100% Google.
  • Google Maps and Places review services
  • No need for plugins. All necessary services, data available
  • Potential (rising) costs over time and ownership issues
  • No customization







Option B:

Open-source Combo.
  • Free! All required map data/services
  • Leaflet/MapBox +MapQuest + OSM
  • Plugins required, build from bottom up (specialized programmers)
  • Highly customizable
  • Yelp review service

Customization with open-source app development.

Option C:

Mixed.
  • Adaptable
  • Apple Maps+MapQuest
    • work around the native API
  • OSM+Google Places
    • opt for alternative review service if Google cost becomes too high


Option D:

Platinum-level custom application.

  • Cloudmade+Yelp (+10M/month)
  • $$$! ($1,500/month and up)



Here is some quick background research for reference:





October 17, 2014

Impossible StreetView Treasure Hunt Map - Using PHP and MySQL database

To help understand how to connect a map with a mysql database, I decided to build my own treasure hunt map using Google Maps. A random marker is placed somewhere in the world at a location stored in the database.


You can't see the marker from the overview map so you literally have to scour StreetView to find it. In case you didn't know, StreetView covers a huge area of the Earth.




The endless search.


The location is based on a random latitude/longitude. Because not all the Earth has GoogleStreetView we must search for the nearest panorama. This function is based on Jim Andrews Teleporter.

Hint: The location often ends up in the Pacific somewhere, so the StreetView will be on the nearest island. It's landed on Easter Island and a station in Antarctica a few times.

A new, random location is placed in the database only when a winner submits their name. When you find the marker, it you can click on the image to record name your forever - or until some other poor soul manages to find the next location.



This one appeared near Moose Factory in Ontario, Canada.

The hidden can location. I may have cheated...



The winners name and a new, random location are passed through AJAX to PHP where they are inserted into the appropriate tables.

 var textcontent = $("#username").val();  
 var dataString = 'username='+ textcontent;  
 var dataString2 = 'locationData='+randomLatLng();  
 $.ajax({  
      type: "POST",  
      url: "winners.php",  
      data: dataString,  
      cache: true,  
      success: function(html){  
           $("#show").after(html);  
           document.getElementById('username').value='';  
           $("#flash").hide();  
           $("#username").focus();  
           }   
      });  
 $.ajax({  
      type: "POST",  
           url: location.php",  
           data: dataString2,  
           cache: true,  
           success: function(data)  
           {console.log("New random location stored on server");}  
      });       

The date is appended in the 'winners' table with a 'on update CURRENT_TIMESTAMP' attribute.

 $sql="INSERT INTO winnertable (name)  
 VALUES  
 ('$_POST[username]')";  

 $sql="INSERT INTO locationtable (latlng)  
 VALUES  
 ('$_POST[locationData]')";  

Winners and winner timestamps are retrieved and displayed when the page loads.

 $sql = 'SELECT name, date  
 FROM winnertable  
 ORDER BY date DESC  
 LIMIT 1';  

Note that we query just the most recent winner by sorting on date and limiting our results to 1 record (the most recent).

 var url = 'callwinner.php';  
 $.getJSON(url, function(data) {  
      $.each(data, function(index, data) {  
           $('#idName').append(data.name);  
           $('#idDate').append(data.date);  
           console.log("Previous winner name: "+data.name);  
           console.log("Previous winner date: "+data.date);  
      });  

And here is your prize: your name displayed in infamy.








July 15, 2014

Who Will Care For Cape St. Mary's?

If you visit Cape St. Mary's,  you will find one of the most unique and spectacular natural attractions in the New World - left with no manager in charge and an interpretation centre in shambles. A year after staffing cuts, the future of Cape St. Mary's hangs in the breeze.

The Cape


Aerial View of Cape St. Mary's (NL Geotourism).


'The Cape' was originally protected in 1967 to provide scientific and educational opportunities around the tens of thousands of unique nesting seabirds that return each year. The site boasts tall rugged cliffs, sea-stacks, and birds within an arms-reach.

In 1994, a narrow access road was paved and a visitor centre opened, staffed with local residents. It's first manager, Tony Power, began as a Reserve Interpretation Technician. When I met him a few years back, I immediately understood he was one of the most genuine people I had ever met. The health and survival of each and every bird at Cape St. Mary's was paramount. It wasn't just a job. He has since received provincial awards for his conservation efforts and is largely credited with reviving the Harlequin Duck population.

Tough Times


I decided to make the 200-kilometre haul out to the Cape with my father this past weekend. We go every year around this time. Most of the chicks hatch around Canada Day so the colony is busy and full of life mid-July. It's also that sweet, brief period of sunshine where you wonder if the entire island accidentally drifted south.

When we reached the end of the long access road to the site, I immediately noticed the Interpretation Centre looked to be in rough shape. The siding was sagged and needed a paint job. As we came closer I saw the front door was partially missing and was covered in plywood.

Dr. Leslie M. Tuck Centre, July 2014.


Inside, a few more pieces were missing. An 'out of order' sign hung on the water fountain. The large arched window over the awning was boarded up. Outside, parts of the wooden deck were cautioned-off.

The park interpreter informed me it's been tough times since the Province slashed the Parks and Natural Areas Division. Last March, 42 people were laid off in Department of Environment and Conservation, with 15 staff positions cut from Provincial Parks and Reserves, including longtime Cape St. Mary's park manager and local steward Tony Power.

Tony's job was eliminated in that provincial budget and he was, instead, made responsible for Mistaken Point Ecological Reserve. A man known for his expertise in Newfoundland seabirds was now in charge of fossils. Cape St. Mary's was to be managed from the Parks and Natural Areas Division head office in Deer Lake, more than 600 kilometres away.

The interpretive staff suggested they have no real direction and difficulty getting anything done without any experienced authority on site. They continue to greet visitors and conduct research in hopes the management situation will be resolved.

It has been over a year since Tony left as manager and another budget has passed without any changes or consultation with people in the area.

The Legacy of Dr. Leslie M. Tuck



Naturalist Dr. Leslie Tuck.
On August 17, 2000, the Interpretive Centre at the Cape was renamed after Dr. Leslie M. Tuck. He was the Province's first Dominion Wildlife Officer upon confederation, and he remained there as our premier naturalist and ornithologist until retirement 27 years later. He conducted research on wolves, polar bears, seals, narhwals, as well as seabirds, in everywhere from the remote Funk Island off Newfoundland, to the Canadian Arctic, Louisiana, Bermuda, Guyana, Trinidad, and Venezuela. His annual Christmas Bird Count bird survey continues today. He raised awareness of oil pollution and shipping concerns around our island, long before the offshore oil boom. He was a prolific author, with over 60 professional and popular publications, including co-authoring the definitive book on birds of Newfoundland. He received numerous awards, accolades, and honorary degrees before he lost his battle with cancer on May 11, 1979.

He helped create Cape St. Mary's Ecological Reserve and the Interpretation Centre that is named in his honour. Tens of thousands visit the Centre each year to see first-hand the natural wonder of bird rock and learn about birds, like Gannets, who return to the same nest and partner every year after global expeditions. Many international tourists make a trip to Canada specifically to see this colony.

Today they are greeted by struggling staff in a run-down building. The lighthouse, governed by the Canadian Coast Guard, looks worse still. The trail is worn and guide posts have fallen -  a sign that visitor traffic outpaces maintenance. Busy oil tanker traffic passes daily, waiting for a catastrophic spill. This is not what Dr. Tuck envisioned.

Where the Hagdowns Sail and Foghorns Wail


We strolled out the grassy cowpath riddled with blue-flag irises, lichen-covered rocks, butterflies, sparrows, and occasionally free-roaming sheep. After about a kilometre walking a few passing visitors comment, "Well worth it!" as they head back.

I remember making this same hike a few years before with Delf, a brilliant musician (and possibly a wizard) who plays the summer performance series at the Centre.

"Is there a Tims out there?", Delf asked a couple returning.
"Pardon?"
"Tims. Coffee. Any coffee at the end? I could use a cup."

Delf had probably visited the isolated site 100 times or more but he liked to mess with tourists.

As I head out the trail this time, I remember the sensory build up. First you hear a faint roar among the waves - thousands of birds coo, purr, and screech together into the loud rumble of a motor engine. As you approach the colony, the 'funk' hits you - a pungent mix of bird guano carried in the salty ocean breeze. Then a few scattered Gannets cruise overhead, skirting the coast before they circle back to the colony.

A Northern Gannet glides in for a landing.

Finally you turn the corner and see 'bird rock' - a 130-metre sea-stack completely covered in nesting Northern Gannets. More Gannets soar effortlessly overhead. Kittiwakes squawk and dive, rapidly twisting their bodies in the air with tiny movements. Murres dot the ocean surface as far as the eyes can see. We look down the coast to see the colony has expanded since last year. There are also lots of healthy chicks that look well-fed. This is a sign the overall population might be doing well and that fish are plentiful this year.

I hope others will visit this beautiful place and learn from it a fraction of what I have. The Cape is a world-class tourist destination and critical to our natural history. It is the crown jewel of Newfoundland and Labrador's natural areas.

Support the Cape by attending the summer performance series at the Interpretation Centre, running July 19 to September 6 or donate to the Friends of Cape St. Mary's.



February 17, 2014

Wind Map

I was glued to this map after experiencing the g-force winds that shook our house in St. John's this weekend:



The map is from a group at earth.nullschool.net who use Global Forecast System and NCEP/NOAA National Weather Service data and this github source for visualizing weather conditions.

I had first seen this beautifully dynamic, visual code applied about year ago in the hint.fm continental US wind map and its great it see it evolve:

hint.fm/wind/

August 12, 2013

Towards an Integrated Provincial Trail System

There exists an enormous potential for the Province of Newfoundland and Labrador to produce and promote an integrated trail network through a cooperative campaign involving several large, established world-class trail systems currently existing in our Province:

East Coast Trail – 265 km of world-class coastal hiking trail along the edge of the North Atlantic.

The Grand Concourse – 160 km of urban walks through the metro-region.

Newfoundland T’Railway(Trans Canada Trail) – 883 km of the former Newfoundland railway extending the entire length of the island.

International ApplachianTrail (NL) - A work in progress, the goal of the IAT is to extend 1200 km along the Long Range Mountains from Port-Aux-Basques to Crow Head at the Northern tip of the Great Northern Peninsula.

Labrador Pioneer Footpath – 110 km (upon completion) of traditional footpath between communities from L’Anse Au Clair to Red Bay.

Vision for an Integrated Newfoundland and Labrador Trail System.


Should these organizations coordinate branding, marketing, and promotion under a common title, the Province of Newfoundland and Labrador could have the largest complete (until TCTrail), connected trail network in the world. A cooperative, integrated trail-system would:

-          increase value of individual trail names/brands,
-          establish long-term presence,
-          protect/conserve hydrological network and natural corridors, &
-          improve recreational benefits by offering multiple route options.


This is an greatly under-developed opportunity for the Province. There has been a steady global rise in non-consumptive, nature-based outdoor recreation tourism. Affluent global travellers seek isolated, unique locations like Newfoundland to come and visit. Many visitors already come for trails - the East Coast Trail and Gros Morne are considered destination attractions. However, few know about the breadth and depth of recreational opportunities that are available here.

Such a coordinated effort could solidify Newfoundland and Labrador as a outdoor-recreation paradise and a top global destination.

Unlike our natural resource industries, revenue from recreation-based tourism is direct, there are no environmental impacts (arguable improvement), comparatively little investment is required (trails exist), and the benefits to community and resident-life are immeasurable.




Scenery the East Coast Trail: sea-stack on the Spout hike.



August 8, 2013

Top Online Mapping Platforms of 2013


Pushing your spatial data, research, and analysis online can add a huge value to it. It lets the public see your efforts and presents research in a digestible, interactive way.

If you're considering online mapping applications, have a look at these: 


CartoDB

An open-source geospatial database platform, CartoDB uses PostgreSQL for a solid backend to your mapping. Fairly simple integration allows you to focus on visualization and analysis - which are stunning.

CartoDB is rapidly making a name for itself after several prominent feature applications, including the Guardian's meteorite map publishing earlier this year:



HOWTO: Every meteorite fall on earth mapped on CartoDB from vizzuality on Vimeo.

No coding is required, but to draw out the really powerful side of this platform you will need to learn some programming knowledge and sort through the documentation. And while there is a free account option, larger users will need to pay a monthly fee - as much as US$149.

Useful tutorials and documentation:
https://www.e-education.psu.edu/cloudGIS/node/67

GIS Cloud

GIS Cloud is a comprehensive online mapping service that allow enterprise-level hosting and management. It uses HTML5 technology, allowing cross-platform compatibility (mobile & desktop). There are several analysis tools and sharing options, with an easy interface for casual GIS users.




For more advanced users, GIS Cloud offers custom app development, integration with ArcGIS, PostGIS, and allows mobile data collection services.
Unfortunately, there are limitations the free service (public maps, 100 MB, 10 000 feature storage limits) and paid services are scaled based on usage. Nevertheless, it's a good all-in-one solution.



Leaflet

For those more familiar with coding, the Leaflet open-source javascript library will allow you to develop mobile-friendly, interactive maps. It is a fairly simple, feather-light (24kb) platform that is highly customizable and extensible. Leaflet is streamlined with CSS3 (sad news for IE6 users) which is noticeably smooth on pan and zoom operations.

You'll have to host your own data and learn some coding to integrate more complex layers. If you have experience or don't mind learning, Leaftlet is well-documented with many examples to quickly get your web or mobile application up and running.





GEO5 

Also making use of HTML5, GEO5 is another lightweight web-technology that "lives below the poverty line". Not to be confused with the geotechnical engineering software, GEO costs nothing (donations are appreciated) and simply requires including a few tags to your website. Then you can draw your map and easily link in all kinds of web-services including WMS tiles, CSV/KML, and even ArcGIS feature services. 

Customization may take a little more work and you still need to find somewhere to host your data. But the price is right!

The technology is really new and still must undergo the rigors of testing, but I suspect the Gods of the Interwebs will be quick to approve, adopt, and perhaps cry a little about their hours of slaving through javascript.

GEO5 map using an ArcGIS feature service (via http://geo5.org/ArcGISExample.html).


ArcGIS Online

The mapping software giant, ESRI, has taken the hint on the push for data-rich web applications and worked steadily over the past few years to make it available to the general public. Although its pricing is heavily scaled, users can create free public accounts and make maps instantly. Now, even casual GIS users with no programming experience can quickly turn a spreadsheet into a dynamic, interactive web or mobile application.

Check out storymap templates. They are customizable applications that can be downloaded and deployed using data hosted from your AGOL account.

ESRI Storymaps draw from ArcGIS Online cloud-based data for customizable, interactive applications.

ESRI has also worked to make their applications functional offline - so you can develop and deploy apps to edit data out in the field without an internet connection.

The costs are still prohibitive and will be restricted to enterprise-level operations but it was announced recently at the ESRI UC in July that users of ArcGIS Desktop 10.2 get a free subscription.



Google Fusion Tables 

If you are familiar with spreadsheets (MS Excel, Google Docs), Google Fusion Tables may be the way to go. They're pretty simple in design and offer huge opportunities for data merging and collaborative analysis - great for data hungry academics and non-profits. Also, hosting is free with your Google account.

Here is a fairly comprehensive guideline to Fusion Table mapping.



Source: The Nature Conservancy - Global Conservation Maps  http://maps.tnc.org/globalmaps.html

June 7, 2013

Google Earth Tour of Newfoundland


View a virtual tour of the island of Newfoundland. Download and open this .KMZ file (must have Google Earth installed). Enjoy!

Newfoundland Tour.kmz