Google Map Block Issue.

Permalink 1 user found helpful
I have a very weird issue with above subject. In a nutshell, I installed the sample site from 5.8.21, no addons etc.

This site is essentially a demo for a potential, so on my laptop.

I edited the Map Block and put in a valid API Key & my office address. All good, potential is happy with the ease of edit/use etc.. She then wanted to use her office address.

Entered her office address, revalidated the API Key, saved and published.

It still displays my geo-location (i.e. my office)!!!

No matter what address I put into the block, it displays my location after save/publish. Went into edit mode to make sure I'm not a complete dolt. It's all good.

Dumped the block, rebooted and created a new Map Block on the Sample's Blank Page. Same steps, same results.

Cache settings are all OFF, cleared cache etc. to be sure and rebooted again.

Interestingly enuff, if I put a new address into the block we get no errors at all, but if I look at the page source, it has my map coordinates in the page source.

If you enter an address at inception time it's all good. However, it "seems" that if you edit the address afterwards, the map coordinates do no get updated in the db, I'm supposing they are stored in the db. I guess I could query to confirm, but this is easier...

As an excercise in terror, I tried the exact same steps on a new "test" install on a basic dummy server and reproduced the same results.

Am I missing something and/or has anyone else run into this?

Thanks for taking the time to read this novella...

 
c5dragon replied on at Permalink Reply
c5dragon
The correct order for edit:
Revalidate the API Key, Enter her office address, save and publish.

When correct, you will see Google maps autocomplete when changing the address.

Block gets lng/lat in the background which is used to set the marker, not the address you typed in the input.
Nomadic replied on at Permalink Reply 2 Attachments
EDIT:, Here is the Map location:
244173 Range Road 283, Calgary, AB T2M 4L5, Canada

Thanks for the reply. I get how to do it as we've done this before.

BUT when I do so I get an error popup saying:
"You must enter a valid location".

The Map location is valid.

This happens on Centos 6.6/7 and IIS 7. We have used the Block on other projects, in fact another project for a location that is literally 1 mile south of the one we are demoing.

We've checked and rechecked everything we can think of. Did a clean install again (raw. no add-ons and using Elemental).

I've attached 2 images for reference.

Any ideas or other thoughts would be appreciated.

Again, thanks for the reply.
c5dragon replied on at Permalink Best Answer Reply
c5dragon
Sometimes it won't recognize an address even if maps is correct:
https://stackoverflow.com/questions/41244725/geocode-api-does-not-re...

Unhide the lng/lat hidden inputs and fill in the coordinates manually,
by using a developer console in ff/chrome or edit/override the maps block form.php
Nomadic replied on at Permalink Reply
Another update to this post.

I installed version 8.2.0 and now I can add any address into the Block I want. In fact, I start to type and the address list is populated.

Save, publish no errors.

EXCEPT, the Long/Lat do not change and still shows the Starter Content Long/Lat as Oregon.

View Source shows me:
var latlng = new google.maps.LatLng(45.5313254, -122.6763493);

Here is what Gmaps returns:
51.076992, -113.843298 for address:
244173 Range Rd 283 RR 6 Calgary AB T2M 4L5

Go to maps and enter either of the above and you wind up at the Correct place.

I then scrubbed everything, installed 8.2.1 again and I get the "Invalid location thing"

So, there must be something goofy between the two versions.

In any case I am now using 8.2.0 and here is a summary of the environment:
# concrete5 Version
Core Version - 8.2.0
Version Installed - 8.2.0
Database Version - 20170711151953

# concrete5 Packages
None

# concrete5 Overrides
None

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

Even using my Office address returns the same long/lat as the starter/sample site does.

It would be nice if I could get a fix for this or at least have a core member have a look.
c5dragon replied on at Permalink Reply
c5dragon
If your address is not in the autocomplete (can't select it) lng/lat won't update. (Or will be empty)
Tried it on clean installs from 8.2 - 8.2.1 and 8.3 and the address is not available.

google_map/controller.php
public function validate($args)
    {
        $error = Core::make('helper/validation/error');
        if (!trim($args['apiKey'])) {
            $error->add(t('Please enter a valid API key.'));
        }
        if (empty($args['location']) || $args['latitude'] === '' || $args['longtitude'] === '') {
            $error->add(t('You must select a valid location.'));
        }
        if (!is_numeric($args['zoom'])) {
            $error->add(t('Please enter a zoom number from 0 to 21.'));
        }
        if ($error->has()) {
            return $error;
        }
Nomadic replied on at Permalink Reply
c5dragon, thanks for this. Yes, this is what I mentioned in previous post. With 8.2.0 the address does indeed show up and is selectable in auto complete.

Save & publish with no errors (can't get this far with 8.2.1).

The issue seems to be that the long/lat coords are not being updated in the DB. They are the same geo coords as with the installed address for Oregon even if I use my soho address.

The perplexing part now is that I installed an "empty" site and validate the API Key, enter address, auto complete populates the list.

Saved & publish - no errors at all. When viewing the map, I'm still in Oregon... I copied the geo coord when viewing the source, dropped into Gmap & Bmap. They both give me the same address as with the sample site data.

I gotta be missing something, and I checked 3 other sites that we have on line and they work with any address/key and they are all 8.2.0.

As an excercise in terror, I'm gonna spin this test site up on a prod server using on of our staging-test domains and see what happens. Maybe something pooched on my dev laptop???

It is frustrating, something so simple...

Again, tx for the thought.
Nomadic replied on at Permalink Reply
Still no go.

We are having zero success with the Map Block, it will not display the map for any address we put in - it will only display the map for the original content.

We've just spun up a test server if anyone is interested in zipping in and trying this.

This is a bare bones, virgin 8.2.0 Elemental site. We don't really care if he gets pooched, but would really like to resolve this.

If someone has the time and feels the urge to to discover some "stupid" mistake or setting that we've missed - we're all in.

Thanks.
c5dragon replied on at Permalink Reply 1 Attachment
c5dragon
These are the results which are returned. (Attached) Tested on a live 8.2.1 site (but is the same for 8.2.1 and 8.2 local).
If you have a login of your own test site (pm)

Did you select one of these?
Does this specific address work on those other sites?
What is the address '1 mile down' that worked?

--
I also noticed that Gmaps(website) also does not autocomplete this address. (It does with others.)
Nomadic replied on at Permalink Reply
The issue is that the MAP is always showing the original map location from the Sample Data.

The autocomplete, for some reason now works and has for a few days.

But, if you complete the entry in the Block, save it (and/or publish) you will see that the Map shows the location from the sample data in Oregon. It does not update, further if you do a "view source" you'll see the long//lat does not change which, to me, suggests that the DB is not getting updated.

I'll pm the access details at about 7:00pm mst.
c5dragon replied on at Permalink Reply 1 Attachment
c5dragon
The above address does not correspond to a value in the autocomplete and will not trigger the update of the lng/lat fields. If you select one of the suggested values it will change.
(Attached, but wrong address)

The other address you send doesn't work either (Not even google maps knows that address).

This is still the best solution if you want the marker on the address you mentioned.
https://www.concrete5.org/community/forums/usage/google-map-block-is...
- Unhide the lng/lat fields and fill in the lng/lat manually.
Nomadic replied on at Permalink Reply 1 Attachment
Okay, now I am really confused. I've attached a Snippet of the Google Map I was presented with after a search using: 244173 Range Rd 283 RR 6 Calgary AB T2M 4L5.

It clearly show that the address is locatable along with the log/lat (at the bottom).
Nomadic replied on at Permalink Reply
Update, I forgot to mention in my previous reply that "unhiding long/lat" seems to work.

By work, I mean it does find the correct location and view source confirms it.

So as not to annoy anyone further, we'll go with the suggested solution.

Thanks for the assistance, your time and input is very much appreciated.
c5dragon replied on at Permalink Reply
c5dragon
Was a great adventure. And now we do know how and why things work (or not work) as they do.

Mark the best answer (my second post) so anyone with the same question can quickly find the solution and can live on with some extra hairs on their head.
Nomadic replied on at Permalink Reply
Marking Done - you get an "A+".
barbedwire replied on at Permalink Reply
I wanted to weigh in on this. I am not necessarily a big fan of long threads, they tend to eventually go off topic.

That being said, I am glad you stuck with this to the bitter end.

Yes, c5dragon did have the fix several posts back, but I think the underlying issue was that the Map Block did not appear to be consistent.

So the assumption would be that it's a C5 Block issue (and/or) DB update issues. Seemed reasonable.

We are in the Midwest and have found the same issues (randomly) with new sites using purchased themes, so "not a C5 issue".

Also, we took the address you provided and dropped it into Google Maps and found that sometimes we would get a location, others not. Even dropping the zip (post code???) yielded different results. The same issue does not seem to manifest itself in Bing Maps.

Now we are happy that we can use the Map Block with confidence because of the "stick to it attitude" of the op.

C5 is awesome - no question. But when things like this popup (and it has with us), one tends to lose confidence.

Confidence renewed.

c5dragon, our thanks to you for sticking this one out as well - Job Done!