Website Update 06-26-2020

26 Jun

Maps and Geocoding and Stuff

The method most commonly used to create a map to a locomotive’s location is called “geocoding”. In brief, we supply you with a map of the general area, you find the locomotive, drop a marker on it and we’re in business.

The problem with this idea, of course, is that we have to have the geographic coordinates (latitude and longitude) of a point somewhere vaguely in the neighborhood of our target locomotive. Usually this point is the “average center” of a geographic object, like a city. With 21,516 locomotives in our database, I can pretty well assure you that no one went through that list, found the middle of each city containing a locomotive, and then entered that into the locomotive’s record as its “localization coordinates”.

Rather a utility program was written to use the Google Maps Geocoding API to obtain these coordinates and enter them into the database. Now API is a term that is often bandied about, but seldom explained. It stands for Application Programming Interface. And what it means in the simplest possible terms is that a series of “functions” have been written to allow my computer to chat politely with your computer.

So when I returned to attack various issues with the website I became aware that there were 1720 locomotives (7.99%) in the database for which localization had failed and another 1030 (4.78%) for which localization had never been attempted. So naturally I brought out that little utility program I had written and used earlier and told it to go to work. And the thing failed on every single one of the 2750 locomotives it looked at. What?!? It used to work just fine. Why not now?

Several days of dread and avoidance ensued. I didn’t want to look at it, didn’t want to debug it. And finally I did. It took an hour to discover that Google had changed the API, so an additional parameter was required. And I fixed it, tested it and sat back grinning.

Today’s Programming Plans

  • I’m going to modify the localization utility so that when it encounters a location it cannot geocode it will log the location, the locomotive’s id and the failure code, so that I can investigate why this happened, and if necessary manually correct it.
  • I’m going to modify the admin routine that allows an editor to move a locomotive from one place to another, so that once the locomotive has been placed in its new location, localization is performed to make mapping possible.
  • Will also add a menu item that allows an editor to manually localize a locomotive.

With all that having been said, the daily change report is, of course, available at:

Daily Change Report 06-26-2020

Leave a comment

Posted by on June 26, 2020 in Website


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: