Jump to content
Touring Motor Gliders Association (TMGA)

Webmaster Updates

  • entries
    9
  • comment
    1
  • views
    4,473

New Maps

Sign in to follow this  
Steve Sliwa

629 views

Well team, I finally completed a big project on my backlog.  I wanted to redo our member maps product.  My original map tool was developed and scabbed together years ago.  In fact, it used Google Maps API v1.  Google does a major version release every three to five years.  So our map now supports V3.x.   My first version managed text files.  My most recent version used XML files.  XML files look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<document>
   <marker lat="Lat" long="Long" name="Name" category="Category">
      <picture-pilot></picture-pilot>
      <picture-plane></picture-plane>
      <manuf></manuf>
      <type></type>
      <regis></regis>
      <airport></airport>
      <location></location>
      <designator></designator>
      <airport_website></airport_website>
      <e-mail></e-mail>
      <website></website>
      <notes></notes>
   </marker>
   <marker lat="26.2469" long="-80.111111" name="Ron  Ackerman" category="member">
      <picture-pilot></picture-pilot>
      <picture-plane></picture-plane>
      <manuf>Grob</manuf>
      <type>109B</type>
      <regis></regis>
      <airport>Pompano Beach Airpark</airport>
      <location>FL</location>
      <designator>KMPP</designator>
      <airport_website></airport_website>
      <e-mail>ronackerman@comcast.net</e-mail>
      <website></website>
      <notes></notes>
   </marker>
   
   <marker lat="43.1142699" long="-89.5315336" name="Ed Adib" category="member">
      <picture-pilot>adib.jpg</picture-pilot>
      <picture-plane></picture-plane>
      <manuf>Phoenix</manuf>
      <type>U15</type>
      <regis></regis>
      <airport>Middletown Municipal</airport>
      <location>WI</location>
      <designator>C29</designator>
      <airport_website></airport_website>
      <e-mail>eeadib@meriter.com</e-mail>
      <website></website>
      <notes></notes>
   </marker>
   <marker lat="10.776389" long="123.015278" name="Roldolfo Z. Alvarez" category="member">
      <picture-pilot></picture-pilot>
      <picture-plane></picture-plane>
      <manuf></manuf>
      <type></type>
      <regis></regis>
      <airport>Bacolod-Silay Int'l Apt</airport>
      <location>Philippines</location>
      <designator>RPVB</designator>
      <airport_website>en.wikipedia.org/wiki/Bacolod-Silay_International_Airport</airport_website>
      <e-mail>rza1224@yahoo.com</e-mail>
      <website></website>
      <notes></notes>
   </marker>
   <marker lat="40.0394297" long="-105.2258217" name="Norm Anderson" category="member">
      <picture-pilot></picture-pilot>
      <picture-plane>N5014A.png</picture-plane>
      <manuf>Brditschka</manuf>
      <type>HB-23/2400</type>
      <regis>N5014A</regis>
      <airport>Boulder Municipal</airport>
      <location>Boulder CO</location>
      <designator>KBDU</designator>
      <airport_website></airport_website>
      <e-mail>norman.anderson@live.com</e-mail>
      <website></website>
      <notes></notes>
   </marker>
   <marker lat="-28.235072" long="29.106206" name="Barry Arnott" category="member">
      <picture-pilot></picture-pilot>
      <picture-plane>ZS-GZT.jpg</picture-plane>
      <manuf></manuf>
      <type>Lambada</type>
      <regis>ZS-GZT</regis>
      <airport>Harrismith Airport</airport>
      <location>South Africa</location>
      <designator>FAHR-HRS</designator>
      <airport_website>www.airport-data.com/world-airports/FAHR-HRS/</airport_website>
      <e-mail>arnott.barry8@gmail.com</e-mail>
      <website></website>
      <notes></notes>
   </marker>

Which is a pain.  Every time someone wanted to be added I need to go in and manually put the data in, sometimes in multiple place.  Plus the code for processing was complex and tricky to maintain.  I'd say it was about 1000 lines of code.

So in this release:

  • Filter commands added to the top of the map.  Once can downselect the markers by using the convenient menu on the top.
  • The data is now sorted by last name.  Most tools sort by the first letter of the words. .  I will show the simple sort algorithm below.
  • The data can be save in a google sheets, similar to our fly-in sign-up sheets.  In the future, I plan to let people add their own data rather than filtering through me.

I hope you all enjoy it.  I estimate this upgrade at about 30 hours.  But it sure is sweet.  Probably only a couple hundred lines of code to manage, and we leverage google sheets. 

I am leveraging the following packages:

  • jQuery
  • Tabletop.js
  • Maplace.js

Here is that clever function that gets added to the built-in sort to sort by last names:

function compare(a, b) {
	    var splitA = a.title.toLowerCase().split(" ");
	    var splitB = b.title.toLowerCase().split(" ");
	    var lastA = splitA[splitA.length - 1];
	    var lastB = splitB[splitB.length - 1];
	
	    if (lastA < lastB) return -1;
	    if (lastA > lastB) return 1;
	    return 0;
	}		                     
          

 

Sign in to follow this  


1 Comment


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×