* Map Life Facts and changes to the Google Map Platform

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
User avatar
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

Map Life Facts and changes to the Google Map Platform

Post by ColeValleyGirl »

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: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

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

Post by ColeValleyGirl »

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: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

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

Post by ColeValleyGirl »

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: 2245
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

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

Post by BillH »

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!
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 plugins:help:map_life_facts:0_google_maps_geocoder|> 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 ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

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

Post by ColeValleyGirl »

Mike,

I agree re securing the key.

Helen
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

I have attached prototype Map Life Facts Plugin Version 4.1.1 Date 12 May 2018 in a ZIP file.
[ Attachment deleted as now in Plugin Store at Version 4.2. ]
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 plugins:help:map_life_facts:map_life_facts|> Map Life Facts Plugin Help & Advice has been updated with plugins:help:map_life_facts:0_google_maps_geocoder|> Map Life Facts ~ Google Maps Geocoder advice for managing your API Key.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
ColeValleyGirl
Megastar
Posts: 5465
Joined: 28 Dec 2005 22:02
Family Historian: V7
Location: Cirencester, Gloucestershire
Contact:

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

Post by ColeValleyGirl »

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

Thanks, Mike,
User avatar
BillH
Megastar
Posts: 2245
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

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

Post by BillH »

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 12971 times
For me the API Restrictions drop down is empty. How do I add the Geocoding API?

Thanks!
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 ~ tatewise ancestry
User avatar
BillH
Megastar
Posts: 2245
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

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

Post by BillH »

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!
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 plugins:help:map_life_facts:get_personal_api_key|> Map Life Facts ~ Get Personal API Key and plugins:help:map_life_facts:manage_quota_limits|> 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 ~ tatewise ancestry
User avatar
BillH
Megastar
Posts: 2245
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

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

Post by BillH »

Mike,

OK, thanks!
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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.
[ Attachment deleted as now in Plugin Store at Version 4.2. ]
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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 Limits.
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.
[ Attachment deleted as now in Plugin Store at Version 4.2. ]

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

See attached prototype Map Life Facts Plugin Version 4.1.4 Date 17 May 2018 in a ZIP file.
[ Attachment deleted as now in Plugin Store at Version 4.2. ]

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.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
BillH
Megastar
Posts: 2245
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

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

Post by BillH »

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 12626 times
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

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 ~ tatewise ancestry
User avatar
BillH
Megastar
Posts: 2245
Joined: 31 May 2010 03:40
Family Historian: V7
Location: Washington State, USA

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

Post by BillH »

Mike,

Yes, that took care of it.

Thanks
User avatar
tatewise
Megastar
Posts: 28341
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

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

Post by tatewise »

I have given some thought to how this Plugin will be presented to new users after 11th June 2018.

Essentially, it will NOT work without an API Key and will produce various error messages.
So I have updated those messages and the Help & Advice F.A.Q. to try and clarify things.

Could you please try the attached Plugin on an unimportant Project such as the FH Sample Project.
But first change the API Key in the Plugin to an invalid one by appending a character or two (not a blank key).
In that unimportant Project ensure the Plugin Set Preference Options Restore Defaults is used, so it is presented in the way a new user would see it.
Please pretend to be a new novice user, and feedback your experiences.

See attached prototype Map Life Facts Plugin Version 4.1.5 Date 22 May 2018 in a ZIP file.
[ Attachment deleted as now in Plugin Store at Version 4.2. ]

BTW:
This version also ensure that symbols & < > ' " \ in Place/Address names are always handled correctly.
It prevents being run on Windows XP and Windows Vista that are no longer supported.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
User avatar
Jane
Site Admin
Posts: 8508
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

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

Post by Jane »

It's probably me, but I went in and deleted Map Life Facts.dat and Map Life Facts.loc from my Project, so I would be a new user, I did not change the plugin source in any way.

I got
2018-05-22_152900.jpg
2018-05-22_152900.jpg (51.13 KiB) Viewed 12423 times
Is there something else I need to delete?
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."
Post Reply