Jump to content
TNG Community
Mark St

Google Map API change

Recommended Posts

Mark St

Good afternoon,

I received an email from Google regarding a change to the map API.  Not sure what this will entail for Darrin.  But they are going to start charging the website owners beginning in June 11.

There will be a $200 credit that everyone will get. If you  go over the limit there will be an additional charge.  This is the pricing site: https://cloud.google.com/maps-platform/pricing/sheet/

This is the overview of whats coming: https://cloud.google.com/maps-platform/user-guide/

The email that was sent out to current users gave them what they could anticipate for billing.

Have a great day,

Mark

Share this post


Link to post
Share on other sites
DelG
53 minutes ago, Mark St said:

This is the overview of whats coming: https://cloud.google.com/maps-platform/user-guide/

I'm still using TNG v10 so have never obtained an API and is a reason I have not upgraded to v11. What's more, I do not even understand what is an API or how my site will be affected in view of this statement on the Google website:

" Also, in June 2016 we announced that we would stop supporting keyless usage, meaning any request that doesn’t include an API key or Client ID. "

Would one or more of you TNG users who understand all this give a 'primer' for the rest of us and how & what core TNG functions may be impacted without an API key? Also, how do we verify our expected usage and consequently the potential costs of continuing our sites?

Seems like things just got a whole lot more complicated!

Thanks..

Edited by DelG
additional question

Share this post


Link to post
Share on other sites
jayat1familytree

I followed the  links in the email to see the recent usage from Google and apparently used the API a whooping 2 x in the last 90 days. 

If they give you 200 per DAY for  FREE, I am not worried. 

Jay 

Share this post


Link to post
Share on other sites
Ken Roy

Jay,

To me the issue is that now you need to provide a credit card in order to use the Google Maps Platform.  

Share this post


Link to post
Share on other sites
Craig Arno

Like most of you, I suspect my usage is "trivial" from Google's point of view and won't trigger any revenue for Google.  One possible exception is when my family and I sit down for a marathon genealogy update.  This is when lots of activity is registered on my site over a short period of time.

Darrin, is it possible to add a switch in "Admin: Setup >> Configuration >> Map Settings " to prevent Google API calls when the monthly Google API Call count trips into the "costs money" territory?  This switch should be "On" by default.  I doubt I'll ever get there, but I'll gain a lot of peace of mind knowing I can set a roadblock in my setup to prevent charges.

Otherwise I'm with Jay, I really don't want to leave my credit card information all over the place just to use some external service that I have no intention of ever being charged to use.  I'd rather Google just rejected my query if I venture into "charging territory" without a credit card.  This seems to be the new business model, I just bought a Roku and found I was forced to leave credit card information before I could complete setup.  My Roku account has an option to require a "pin/password" before accepting charges, but this doesn't address leaving my credit card information with Roku, and for me creates several new possible security failure points.

After wasting the morning on this Google issue, I'm with some of the other posted commenters, how much effort to switch to another service, like Bing?  Or do we leave well enough alone and request from Darrin the smallest change possible to block charges.  I'm all for not wasting Darrin's time every time an external site develops a new creative way to siphon more money from our wallet, or some other predatory way to hold customers/clients hostage... kind of like what the city of Seattle is trying to do to Amazon for taxes.

Share this post


Link to post
Share on other sites
Ken Roy

I would not recommend switching to Bing because Microsoft is likely to follow Google and start charging.

My understanding is that if we do not provide a credit card on our Google Account, that Google Maps will quit working on June 11th.  Unless Google lifts that requirement.

Share this post


Link to post
Share on other sites
Ken Spratlin

The documentation for the new Google Maps Platform is scattered across multiple pages making it hard to find and challenging to understand. Some of it is possibly contradictory, including for billing. The first Q&A (pasted at the bottom of this post) appears to say you have to enable billing to get the $200 monthly credit. The second Q&A (pasted at the bottom of this post) appears to say you could choose to not enable billing and "risk" degraded performance or "return an error" if your usage exceeds the $200 monthly credit. But do you get the credit without billing enabled?

To stay below the $200 monthly credit (for a high traffic site, or in case a "rogue" user runs up your Google Maps Platform usage), it may be necessary to lower the usage limits from their defaults.

Under Google Cloud Platform > APIs & Services > Dashboard, you can see which APIs you are actually using.

Under Google Cloud Platform > IAM & admin > Quotas, you can see all the API usage limits you can set.

It appears you need to look at the limits for at least:

- Geocoding API, Requests per day
- Maps JavaScript API, Map loads per day

Under Google Cloud Platform > Billing > Budget & alerts, you can then set a monthly budget to prevent using more than the $200 monthly credit regardless of how your API limits are set.

It is not obvious if you can set the limits NOW at their correct free limits for use after June 11, 2018 when the new pricing takes effect. It appears the free limits are changing.

This page lists the technical changes to Google Maps Platform including several that affect Places (the new set of APIs that include Geocoding):

https://cloud.google.com/maps-platform/user-guide/product-changes/

~~~

Can I still use Google Maps Platform for free?

Yes. Starting June 11, 2018, when you enable billing, you get $200 free usage every month for Maps, Routes, or Places. Based on the millions of users using our APIs today, most of them can continue to use Google Maps Platform for free with this credit.

Is a credit card or billing account required?

Even though your first $200 of monthly usage is free, all Google Cloud Platform services require a credit card and billing account, to cover any amount you spend over this free credit. If you are billed, we'll credit your account for the first $200 of monthly usage. If you choose not to add a billing account, there is a risk that if your usage exceeds $200 in a given month, your Maps API implementation will be degraded or other API requests will return an error. If your estimated usage will be above $200 a month and you don't have a credit or debit card to set up a billing account, a local Google Maps Partner may be able to help.

Share this post


Link to post
Share on other sites
Craig Arno
1 hour ago, Ken Spratlin said:
Is a credit card or billing account required?

... If you choose not to add a billing account, there is a risk that if your usage exceeds $200 in a given month, your Maps API implementation will be degraded or other API requests will return an error.

Can I still use Google Maps Platform for free?

... Based on the millions of users using our APIs today, most of them can continue to use Google Maps Platform for free with this $200 credit.

Looks like this answers the question.  I can continue to use the Google API services without setting up a "billing account".  If $200 usage is exceeded, then service is degraded or fails.  This is acceptable.

Since Google's estimation is most customers will never exceed the $200 limit, my site appears to be covered, for now.

Thanks for adding the "product-changes" link Ken, I verified the language copied in your message.  Looks like most if not all TNG users don't need to be concerned.  I reloaded my own TNG page with 24 map pins and got an API hit of "5".  According to the billing page it appears ~20 API calls is about 1¢.  This translates to about 80,000 page views to reach $200.  I don't think my site is anywhere near that level of activity, even during "family update marathons".

Share this post


Link to post
Share on other sites
DelG
3 hours ago, Ken Spratlin said:

If your estimated usage will be above $200 a month and you don't have a credit or debit card to set up a billing account, a local Google Maps Partner may be able to help.

Sounds like the various drug company commercials which tout the benefits of their own pills, but..."If you cannot afford your medication, [Google] may be able to help". Ah, the free and open internet architecture!

Share this post


Link to post
Share on other sites
Ken Roy

Except if you login to your Google Account, it shows

Quote
 
Project Status

Not sure if that is just a nag or whether I will lose access to Google Maps on June 11th, since I will not be adding a credit card and will not have a billing account.

Share this post


Link to post
Share on other sites
XerxX

If I don't misunderstand this, any bot traversing my 38,502 persons database will add to the count.

Being indexed by GOOGLE will add to the count. Maybe they will index my site completely now ;) (They never have)

 

On 2018-05-04 at 7:15 PM, Craig Arno said:

I reloaded my own TNG page with 24 map pins and got an API hit of "5".

Does more pins give more hits? Even worse!

I have two heavy custom maps - "Ancestor's birthplaces" & "Descendant's deathplaces" - showing up to 150 pins (my set limit).

They can only be accessed by members but they are popular and will add heavily to the count.

 

Could it be possible to stop showing maps for guests?

Could it be possible to add a button for logged-in members to show the map?

That is: No call to Google by default?

But then again: I still have to give them my CC details... Which I prefer not to.

 

/Erik

Share this post


Link to post
Share on other sites
manofmull

Erik

I have this mod installed and have the map collapsed by default i.e. has to be clicked to view.

https://tng.lythgoes.net/wiki/index.php?title=Person_Map

A couple of years ago I mentioned to Darrin, to consider using other open-source maps and to dump googlemaps.

Up to now I've had no problems with showing maps, no key (older sites don't need a key) and agree with Ken re credit card.

I would simply turn off maps if need be.

 

Michael

Share this post


Link to post
Share on other sites
Ken Roy

Michael,

If you read the Google announcements carefully, older sites with no API keys will quit working on June 11th

Share this post


Link to post
Share on other sites
manofmull

Ken

I did wonder about that, so mentioned it. Thank you for confirming.

I'm not even going to bother with a key, so will turn maps off.

 

M

Share this post


Link to post
Share on other sites
Ken Roy

Of course, Google might back off from their stated objective of requiring a credit card.  Lots of developers are upset.  

I will just leave my API key without a credit card on my account and see what happens.  If the maps go away then there is no much I can do about it.

Some knowledgeable javascript programmers (I am not one) would be needed to replace Google Maps with Open Street Map in TNG

Share this post


Link to post
Share on other sites
manofmull

Just dawned on me that I can't simply turn maps off, without leaving an unsightly blank/grey area.

Question : how can I completely remove the event map from my TNG setup ?

 

M

Share this post


Link to post
Share on other sites
Denton

Use the mod "Person Map".  It will give a small icon for toggling the map on and off.

Denton

Share this post


Link to post
Share on other sites
XerxX

@manofmull, I think you can simply delete your Google Map Key in Admin >> Setup >> Map Settings

 

Very late last night I found this that I will investigate closer tonight. How to place an OSM at a page and add multiple pins.

If you know HTML and JS maybe we can cooperate?

Quote

Check out: this multiple markers example:

 
    It uses the open source JavaScript library called OpenLayers (There's an equivalent example for leafletJS)
    The map is initialised with a basemap layer from the default OpenStreetMap tile server (other tileservers and alternative renderings of OpenStreetMap data are available)
    It adds a 'Vector' layer, where the markers are defined.
    It needs a marker image file placed in a 'img' folder alongside
    It adds three markers. If you were adding more, you might want to do this by defining an array first, and then looping through this as in this example
    As an exampe of event handling, it detects the event of selecting the marker, and calls 'createPopup'

 

Both examples include HTML and JS source.

/Erik

Share this post


Link to post
Share on other sites
manofmull

Erik

I don't have an API key (old site), but if googlemaps stop working, then I'd like to remove the event map completely i.e. I don't want to see a grey/blank area 

 

Michael

Share this post


Link to post
Share on other sites
Katryne

Erik,

OSM is what I asked for last wednesday in this other thread :

I am no coder and won't be able to make a mod for it. But have a loo k at my online albums with maps by OSM. They are really running perfectly, and I may choose between 6 or 7 map types.

http://photos.katrynou.fr/

http://photos.revestou.fr/

I certainly will never give my banking details to Google and I prefer not to display any map at all. While Open Street Map is made by contributors, by you and me, and it belongs to the community, to every one of us.

Share this post


Link to post
Share on other sites
XerxX

Thanks Katryne,

 

Looks really inspiring!

I will have a look at the HTML/JS source later. Right now I have just started to simply try to display a map in getperson.php. With or w/o pins...

Just now started, means it will not be done tonight, probably. I will work evenings with this as I have other things to do during daytime ;)

 

Best regards,

Erik

Share this post


Link to post
Share on other sites
XerxX

 

I can show a small step of progress:

 
 
The zoom is semi-fixed (all Swedish places are zoom = 10).
There are no indeces for the pins.
All pins are of the same colour.
Maybe the calc for centering the map isn't quite correct? (Tried another ID and it was way off)
It takes some time to display the map...
 
More later.
Erik

Share this post


Link to post
Share on other sites
Katryne

I follow your progress, you are our only hope, Obi-Wan Kenobi. (well maybe not the only one)

Share this post


Link to post
Share on other sites
XerxX

Hi All,

 

@Katryne: Thanks! That can really be helpful.

 

@All:

If someone would like to try this, and to try to help us all, this is what I did - nothing complicated really:

 

1a) I made a copy of getperson.php and named it getpersonOSM.php (check the link above).

1b) I modified the line include("tng_begin.php"); to read include("tng_beginOSM.php");

2a) I made a copy of tng_begin.php and named it tng_beginOSM.php

2b) I modified the line include($cms['tngpath'] . "genlib.php"); to read include($cms['tngpath'] . "genlibOSM.php");

3a) I made a copy of genlib.php and named it genlibOSM.php

3b) I modified the line include_once($cms['tngpath'] . "googlemaplib.php"); to read include_once($cms['tngpath'] . "googlemaplibOSM.php");

4a) I made a copy of googlemaplib.php and named it googlemaplibOSM.php

4b) I modified this part of the script
 

Quote

 

?>
<script type="text/javascript">
//<![CDATA[
    //more setup needed here?
    var maploaded = false;
<?php

 

to look like this:
 

Quote

 

?>

<script src="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.11/lib/OpenLayers.js"></script>

<script type="text/javascript">
//<![CDATA[
    //more setup needed here?
    var maploaded = false;
<?php

 

4c) I modified this part:

Quote

 

    function ShowTheMap() {
        var myOptions = {
            scrollwheel: false,
            scaleControl: true,
            zoom: <?php echo $zoom; ?>,
            center: new google.maps.LatLng(<?php echo "$centLat,$centLong"; ?>),
            mapTypeId: google.maps.MapTypeId.<?php echo $map['displaytype']; ?>
        };
        var map = new google.maps.Map(document.getElementById('map'), myOptions);

        var bounds = new google.maps.LatLngBounds();
        var contentString, icon;
<?php
        //do the points
        reset($locations2map);
        $markerNum = 0;
        $usedplaces = array();
        $zoom = 10;
        while(list($key, $val) = each($locations2map)) {
            $lat = $val['lat'];
            $long = $val['long'];
            $htmlcontent = $val['htmlcontent'];
            $pinplacelevel = $val['pinplacelevel'];

            if(!$pinplacelevel) $pinplacelevel = $pinplacelevel0;
            $zoom = $val['zoom'] ? $val['zoom'] : $zoom;
            $uniqueplace = $val['place'] . " " . $lat . $long;

            if($lat && $long && ($map['showallpins'] || !in_array($uniqueplace,$usedplaces))) {
                $usedplaces[] = $uniqueplace;

                $markerNum++;
                echo "   contentString = '$htmlcontent';\n";
                echo "   var point$markerNum = new google.maps.LatLng($lat,$long);\n";
                echo "   var infowindow$markerNum = new google.maps.InfoWindow({content: contentString});\n";
                echo "   icon = \"{$cms['tngpath']}google_marker.php?image={$pinplacelevel}.png&text={$markerNum}\";\n";
                echo "   var marker$markerNum = new google.maps.Marker({position: point$markerNum,map: map,icon:icon,title:\"" . @htmlspecialchars($uniqueplace, ENT_QUOTES, $session_charset) . "\"});\n";
                echo "   google.maps.event.addListener(marker$markerNum, 'click', function() {infowindow$markerNum.open(map,marker$markerNum);});\n";
                echo "   bounds.extend(point$markerNum);\n";
               }
        }
        if($markerNum > 1) {
            echo "   map.fitBounds(bounds);\n";
            echo "   google.maps.event.addListenerOnce(map, 'zoom_changed', function(event) {\n";
            echo "       if (map.getZoom() > $zoom) {\n";
            echo "           map.setZoom($zoom);\n";
            echo "       }\n";
            echo "   });\n";
        }
        else {
            echo "   map.setCenter(bounds.getCenter());\n";
            echo "   map.setZoom($zoom);\n";
        }
?>
        maploaded = true;
    }

 

to look like this:

Quote

 

    function ShowTheMap() {

    map = new OpenLayers.Map("map");
    map.addLayer(new OpenLayers.Layer.OSM());
    
    epsg4326 =  new OpenLayers.Projection("EPSG:4326"); //WGS 1984 projection
    projectTo = map.getProjectionObject(); //The map projection (Spherical Mercator)

    var lonLat = new OpenLayers.LonLat( <?php echo $centLong; ?> ,<?php echo $centLat; ?> ).transform(epsg4326, projectTo);

    var zoom=<?php echo $zoom; ?>;
    map.setCenter (lonLat, zoom);

    var vectorLayer = new OpenLayers.Layer.Vector("Overlay");

    var contentString, icon;

<?php
        //do the points
        reset($locations2map);
        $markerNum = 0;
        $usedplaces = array();
        $zoom = 10;
        while(list($key, $val) = each($locations2map)) {
            $lat = $val['lat'];
            $long = $val['long'];
            $htmlcontent = $val['htmlcontent'];
            $pinplacelevel = $val['pinplacelevel'];

            if(!$pinplacelevel) $pinplacelevel = $pinplacelevel0;
            $zoom = $val['zoom'] ? $val['zoom'] : $zoom;
            $uniqueplace = $val['place'] . " " . $lat . $long;

            if($lat && $long && ($map['showallpins'] || !in_array($uniqueplace,$usedplaces))) {
                $usedplaces[] = $uniqueplace;

                $markerNum++;

                echo "var lon = ".$long.";\n";
                echo "var lat = ".$lat.";\n";

                echo "var feature = new OpenLayers.Feature.Vector(
    new OpenLayers.Geometry.Point( lon, lat ).transform(epsg4326, projectTo),
    {description: 'marker number <?php echo $markerNum; ?>'} ,
    {externalGraphic: 'img/038.png', graphicHeight: 34, graphicWidth: 20, graphicXOffset:-10, graphicYOffset:-34  }
);             
vectorLayer.addFeatures(feature);\n";
               }
        }
        echo "map.addLayer(vectorLayer);";

?>
        maploaded = true;
    }

 

This is more or less just copied and inserted from the example I linked to a few posts above.

The last part of the code doesn't seem complete (what's with the feature thing - should be doing something with the pins?) AFAIU the example.

Maybe it will be solved by the doc in Katryne's latest link.

 

More later,

Erik

Share this post


Link to post
Share on other sites

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

×