*Map Life Facts and changes to the Google Map Platform

Writing and using plugins for Version 5 and above.
User avatar
ColeValleyGirl
Megastar
Posts: 637
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Map Life Facts and changes to the Google Map Platform

Postby ColeValleyGirl » 11 May 2018 09:51

Mike, What will the impact of the Google Map Platform changes be on the operation of the Map Life Facts plugin?

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 11 May 2018 10:36

Thanks for the heads-up.
It looks like the Map Life Facts Plugin will cease working after 11th June 2018 without an API Key.

Seems that users will have to create a Google Billing Account within a standard Google Account to obtain an API Key.
That will require a Credit/Debit Card, but Google says there will be a $200 free usage allowance per month, and that usage limits can be applied so that allowance is never exceeded.

I guess the Plugin will have to be updated to request the API Key on initial use.
Mike Tate ~ researching the Tate and Scott family history.

User avatar
ColeValleyGirl
Megastar
Posts: 637
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby ColeValleyGirl » 11 May 2018 10:44

I'd guessed it would be something like that -- it's such a useful plugin that I'd hoped it would continue working. (I already have my API key :) )

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 11 May 2018 11:34

After signing in to my Google account, I visited https://cloud.google.com/maps-platform/user-guide/ and followed the GET STARTED link to get my API Key.

From my Google account profile, I could not find any links to the Google Maps Platform account.
So visited https://cloud.google.com/maps-platform/user-guide/ and via Support and Console found a link to Google Cloud Platform Console that has all the API details for the API Key and Quotas, etc.

That will all have to be added the the Plugin Help & Advice.

Now need to start working out where to use the API Key in the Plugin script :roll:
Mike Tate ~ researching the Tate and Scott family history.

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 11 May 2018 14:34

I seem to have successfully hard coded my API Key into the Plugin script and updated some other minor API details.

If I alter the API Key code, then it gives Request Denied as the response status, so it is actually working.

Just need to update the GUI to request the API Key code from the user and save it with the sticky settings.
I am planning to save it as a Global setting rather than per Project - does that make sense?
Mike Tate ~ researching the Tate and Scott family history.

User avatar
ColeValleyGirl
Megastar
Posts: 637
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby ColeValleyGirl » 11 May 2018 15:59

Yes, I think a Global setting makes sense -- most normal ;) people won't want to manage more than 1 key.

I know it's possible to secure the key so that it only works from specific urls (to stop total strangers using your key) but I couldn't see how to make that might work with the plugin.

User avatar
BillH
Megastar
Posts: 1262
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Map Life Facts and changes to the Google Map Platform

Postby BillH » 11 May 2018 16:31

I took a look at this and must admit I really don't understand it at all. :?

Once the dust clears I hope you folks will create a KB article that explains step by step exactly what we need to do in order to create a key and use it in the plugin. :)

Thanks!
Bill Henshaw

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 11 May 2018 18:50

Helen:
Perhaps we can wait until after 11th June to investigate securing the API Key (if considered necessary).
Anyway, most users will limit their Quotas to stay within the $200 per month free credit.
So even if the API Key was compromised, its use would be restricted and not invoke any charges.
Also, it is very easy to regenerate a new API Key at any time if you think it has been compromised.

Bill:
Yes, don't worry, the Help & Advice, probably in Knowledge Base > Map Life Facts ~ Google Maps Geocoder, will explain what is involved to create an account to obtain an API Key, and how to restrict the Quotas to avoid any charges, etc, etc.
The Plugin Set Preference Options > Location Plot Options tab will allow the API Key to be entered.
Mike Tate ~ researching the Tate and Scott family history.

User avatar
ColeValleyGirl
Megastar
Posts: 637
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby ColeValleyGirl » 11 May 2018 19:41

Mike,

I agree re securing the key.

Helen

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 12 May 2018 16:27

I have attached prototype Map Life Facts Plugin Version 4.1.1 Date 12 May 2018 in a ZIP file
That has a Google Maps API Key field on the Set Preference Options tab in the Location Plot Options tab.
Until 11th June that field can be left blank or have a valid API Key.
If you enter any other text, the Plugin will produce a Geocoder API Request Denied status.

If there are any problems you can revert to the Plugin Store Version 4.1.
Alternatively rename either Plugin to allow them to exist side by side, but only add a suffix to the core name.
e.g. Map Life Facts New or Map Life Facts Store.

The Knowledge Base > Map Life Facts Plugin Help & Advice has been updated with Knowledge Base > Map Life Facts ~ Google Maps Geocoder advice for managing your API Key.
Attachments
Map Life Facts.zip
Version 4.1.1 Date 12 May 2018 ZIP
(87.9 KiB) Downloaded 5 times
Mike Tate ~ researching the Tate and Scott family history.

User avatar
ColeValleyGirl
Megastar
Posts: 637
Joined: 28 Dec 2005 22:02
Family Historian: V6.2
Location: Cirencester, Gloucestershire
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby ColeValleyGirl » 12 May 2018 16:50

That works (especially once I removed the limitation on what websites could access the API!)

Thanks, Mike,

User avatar
BillH
Megastar
Posts: 1262
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Map Life Facts and changes to the Google Map Platform

Postby BillH » 12 May 2018 17:47

In the KB for restrictions on the key you say:

Key restrictions can also be applied. It is thought that for this Plugin, the API restrictions can be constrained to just the Geocoding API.

How do you set such a restriction?

This is a part of the screen shot:

image1.jpg
image1.jpg (60.3 KiB) Viewed 549 times


For me the API Restrictions drop down is empty. How do I add the Geocoding API?

Thanks!
Bill Henshaw

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 12 May 2018 18:09

That is odd. The Select API drop list should include 8 API with Geocoding API at the top.

If you return to the APIs & Services > Dashboard are 8 API listed at bottom of page.
If none are listed, then they should be enabled via ENABLE APIS AND SERVICES.
Choose the Maps category on the left, select the Geocoding API, and Enable it.

May be when Enabling Billing you ticked Maps instead of Places or something?
Mike Tate ~ researching the Tate and Scott family history.

User avatar
BillH
Megastar
Posts: 1262
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Map Life Facts and changes to the Google Map Platform

Postby BillH » 12 May 2018 19:13

Mike,

There were no APIs listed. I enabled the Geocoding API. Now under the restrictions, there is just the one API listed. I had not enabled it earlier as the KB didn't say anything about enabling anything. Maybe the KB needs updating?

Are there other API's that need to be enabled? Do I need the other 7?

In the KB you said "Set Requests per day to 15,000 to keep within the $200 free credit. Leave both Request per 100 seconds at 5,000."

I was unable to "leave" the setting "Requests per 100 seconds per user" at 5000 because it was defaulted to "unlimited". I changed it to 5000. Maybe the KB needs updating?

After enabling the Geocoding API and updating the quotas, the plugin seems to be working fine. I plotted a couple of locations without any problems.

Thanks Mike!
Bill Henshaw

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 12 May 2018 19:28

Bill,
I think what happened is when enabling Billing Account you ticked Maps on the left instead of Places on the right.
That is an understandable mistake as the Plugin is all about Mapping.
I repeated that mistake and got no API like you.

You only need the Geocoding API and none of the other 7.

I have now tried to make it clear in KB to select Places and NOT Maps or Routes.

Thanks for the other feedback - I could not remember the original settings - so have updated KB.

I have further updated the KB Help & Advice throughout to reflect what will be in Version 4.2 when it is published.
Mike Tate ~ researching the Tate and Scott family history.

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 13 May 2018 14:05

On reviewing the API usage statistics, it seems that the Maps JavaScript API is also used and thus should be added to the API restrictions and its Quota adjusted as described in Knowledge Base > Map Life Facts ~ Get Personal API Key and Knowledge Base > Map Life Facts ~ Manage Quota Limits. It has a high free usage limit, so no charges will ever apply.

Bill, this means you must Enable this Maps JavaScript API too.
Mike Tate ~ researching the Tate and Scott family history.

User avatar
BillH
Megastar
Posts: 1262
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Map Life Facts and changes to the Google Map Platform

Postby BillH » 13 May 2018 15:41

Mike,

OK, thanks!
Bill Henshaw

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 14 May 2018 17:09

Further investigation reveals that the Maps JavaScript API is definitely used for displaying maps, and will need the API Key.
The Plugin Maps have only been working up til now, because at present no API Key is required.

Attached is prototype Map Life Facts Plugin Version 4.1.2 Date 14 May 2018 in a ZIP file.
This employs the API Key for Maps both in the Plugin window and external map files.
It also fixes a related bug I discovered yesterday in testing.

So ensure both the Geocoding API and Maps JavaScript API are assigned in API restrictions.

I thought the Plugin would need features to handle changes to the API Key if it gets Regenerated.
But in fact the old API Key remains active for 24 hours, while the new API Key becomes active immediately.
Thus all the scripts and files continue to work with the old API Key for a day.
After entering the new API Key, the Plugin must be closed and reopened to start using it in external map files.
So both API Keys are active together for a day to give time for all map files to be recreated.
I have updated the Help & Advice to cover that scenario.
Attachments
Map Life Facts.zip
Version 4.1.2 Date 14 May 2018 ZIP
(87.72 KiB) Downloaded 2 times
Mike Tate ~ researching the Tate and Scott family history.

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 15 May 2018 11:54

I have given the visibility and positioning of the API Key in scripts a bit more thought.

The API Key held within the C:\ProgramData\Calico Pie\Family Historian\Plugin Data\ folder, and shown in the Plugin dialogue Google Maps API Key box, are not a significant security risk, especially on a password protected PC.

However, with current webpage map...html files, the API Key can easily be seen when rendered in a browser, by using right-click View Page Source or similar features. So if those map files are included in a website, then anyone viewing its webpages can easily discover your API Key, which is a slight security risk, mitigated by API restrictions and Quota Limis.
Also, because the API Key is in every map...html file, they must all be recreated if the API Key gets Regenerated.

So, I have updated the Plugin such that the API Key is only at the end of the mapfacts.js Java Script file.
Thus it is a little more difficult for the casual viewer to find your API Key.
(They must use View Page Source, click open the mapfacts.js file, and scroll right to the end.)
More significantly, only that one mapfacts.js file needs modifying if the API Key gets Regenerated.
That file can either be edited by hand, or the Plugin Google Maps API Key box updated.
Thus the webpage map...html files no longer need to be recreated.

Attached is prototype Map Life Facts Plugin Version 4.1.3 Date 15 May 2018 in a ZIP file.

You will need to recreate all your current map...html files in order to reap the above beneficial changes.

BTW: I am working on getting both Place names in EMIG/IMMIgration events fully working.
Attachments
Map Life Facts.zip
Version 4.1.3 Date 15 May 2018 ZIP
(89.57 KiB) Downloaded 1 time
Mike Tate ~ researching the Tate and Scott family history.

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 17 May 2018 10:42

See attached prototype Map Life Facts Plugin Version 4.1.4 Date 17 May 2018 in a ZIP file.

This implements all the API Key features discussed earlier in preparation for Monday 11th June.
Does anyone have any ideas on how to hide or protect the API Key any better?
Remember it must be able to be used on the owner's PC, anywhere they send a CD/DVD or any Website that uses the maps.

It now includes both Place names found in EMIG/IMMIgration Events wherever relevant.
In map pages, each such Event in the list of Facts has two hyperlinks to the two marker pins in the map.

In maps (except in Geocode Location Plots tab) all Place & Address names have commas tidied.
i.e. Commas have no preceding space, have just one following space, and repeated, leading & trailing commas are removed.
The untidy format is essential in Geocode Location Plots tab to synchronise with Place record names.

Please check and feedback any issues, before I publish in the Plugin Store.
Attachments
Map Life Facts.zip
Version 4.1.4 Date 17 May 2018 ZIP
(90.23 KiB) Downloaded 4 times
Mike Tate ~ researching the Tate and Scott family history.

User avatar
BillH
Megastar
Posts: 1262
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Map Life Facts and changes to the Google Map Platform

Postby BillH » 17 May 2018 15:59

Mike,

Not sure if you were planning on tidying the pop up on the Create Web Page Maps tab when clicking on a marker, but here is an example of how they are not getting tidied.

image1.jpg
image1.jpg (102.67 KiB) Viewed 179 times
Bill Henshaw

User avatar
tatewise
Megastar
Posts: 13746
Joined: 25 May 2010 11:00
Family Historian: V6.2
Location: Torbay, Devon, UK
Contact:

Re: Map Life Facts and changes to the Google Map Platform

Postby tatewise » 17 May 2018 17:54

Bill, have you rebuilt that map using Map This Individual (or Map All/Some Individuals) buttons?

If not, then it is still displaying the map built previously.
All the text is 'frozen' in the old existing map database until remapped.

Perhaps I should have repeated that you must recreate all your current map...html files to reap the beneficial changes.

The same goes for instance if you change the Set Preference Options > Location Plot Options > Locations From option.
None of the maps change the popup names displayed until remapped.
Likewise, any Facts or Places added to the Project do not appear in maps until mapped or plotted.
Mike Tate ~ researching the Tate and Scott family history.

User avatar
BillH
Megastar
Posts: 1262
Joined: 31 May 2010 03:40
Family Historian: V6.2
Location: Washington State, USA

Re: Map Life Facts and changes to the Google Map Platform

Postby BillH » 17 May 2018 20:52

Mike,

Yes, that took care of it.

Thanks
Bill Henshaw


Return to “Plugin Discussions”

Who is online

Users browsing this forum: No registered users and 3 guests