Closed vaughn-taylor closed 6 years ago
Hey! Thanks for buying the plugin! Correct, it’s not supposed to be a manual process, that’s kind of the point if the plugin :) A possible issue could be that Google’s geolocation service can’t get the coordinates for the address you entered but that wouldn’t be my go-to answer here.
Would you mind sharing the address you’re entering? Access to the CP would also be great to debug this, you can make in account for jan@studioespresso.co if that’s possible. Will look into it first thing tomorrow.
Great! I've sent you an invitation to login.
Could you point me to the entry with the address that isn't working? I checked the calendar events and those with addresses all seem to have coordinates.
It's when a new event is created. The events that already have coordinates required that I manually drag-drop the pin to the correct location. Feel free to create a new event. The site is not officially "live" at this time.
So you make a new entry and click the marker icon right away? Or you enter an address first and then click the icon?
Hey Vaugh, Could you turn dev mode on (temporarily) on the site? Getting an error when saving with an empty address and I'd like to know if it's my plugin or not. Thanks.
I make a new entry, I enter the name, street address, postal code, city and state -- then I click the marker icon.
I also noticed that when I save a Calendar by going to:
Calendar > Calendars > Cancer Care (for example) > Save
I get a FAILED message at the bottom of my navigation. I checked the message in the 'queue' table of the database:
Client error: GET https://maps.googleapis.com/maps/api/geocode/json?address=&key=AIzaSyBF4FGtqxS5RUDRYickC3b9sQ5fyj-JFbc
resulted in a 400 Bad Request
response:
{
"error_message" : "Invalid request. Missing the 'address', 'components',
'latlng' or 'place_id' parameter.",
"re (truncated...)
I'm assuming this is related to your plugin because it's referencing my Google API Key?
Yep, that's my plugin. Will have a look later today!
Just released 1.1.2, that should fixed the issues with saving an empty address. Could you update when you get the chance?
Regarding the misplaced marker on a new entry: The -locate-marker modal currently has 2 way to get a starting position: 1) if your field has coordinates it'll start from those 2) if the field does not have coordinates it will prompt you to get your current location and start from those coordinates.
If you don't allow the current coordinates option, the modal has no fallback and will show the marker at 0",0".
A quick fix here is saving the entry after you've entered the address and then putting the marker in the correct location.
Sorry, I was under the impression that the long/lat fields would be populated based on the address, postal code and state fields? My current location is not necessarily a good starting point because it assumes that the location I'm attempting to mark is near me -- usually the locations are not near me.
I was hoping that your plugin would produce similar functionality to LongLat (https://www.latlong.net/) because I want to reduce the burden on our content managers of needing to visit that site to get coordinates.
The plugin does that, but only after saving the entry first.
The "marker in the sea" case only happens when you make a new entry, enter an address and you click the marker button before you save the entry. When you enter the address, save the entry and then you click the marker button, the coordinates will be filled and used.
Could you give that a try?
I tried what you suggested, and it didn't work as you explained it should:
I tried the same procedure again, but instead of clicking "Save and Continue Editing", I clicked "Save". I then reopened the entry, clicked the marker button, and the map pin was near Africa again.
I expect that something is going wrong the the response we get from the Google geocoding API here. There's a new update out that adds logging to this part of the plugin. Could you install that update and try again?
If you still have devMode
enabled and there is an error, you'll see an exception in the CP when saving the entry. If devMode
is off, you can check storage/logs/web.log
and search for easy-address-field
.
When the error you see is This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console
, make sure that Google Maps Geocoding API is enable for the project in your Google Developer console.
Could you give this a go? Thanks!
Hi, thing seem to have gotten worse with your last update. When I save an entry now, I get an error page and I cannot save my entry.
Google API error: API keys with referer restrictions cannot be used with this API.
It's pointing to this page:
/vendor/studioespresso/craft-easyaddressfield/src/services/GeoLocationService.php
Hey Vaughn That's what's causing the issue with the missing location. (see my previous comment, you're getting this error because devMode is still on).
Can you check you your Google Developer Console if the Google Geocoding API is enable for the project your using?
EDIT: The error also seems to refer to a restriction on from which URL the API key can be used, make sure you also add just staging url (and later the live url) there.
That should clear the error and probably the initial issue as well.
Yes, for the API Key I'm using (ends with -JFbc), I have the following APIs enabled:
Google Maps Geocoding API Google Maps Javascript API Google Maps Directions API Static Maps API Google Maps Distance Matrix API
My referrers are set to:
(star).calendar.ochsner.org/(star) (star).calendar.ochsner.local/(star)
Can you roll back your previous version so I can at least have a functional version?
Could you perhaps make my account admin for a second so I can try with a different API key?
On 23 Apr 2018, 17:25 +0200, Vaughn D. Taylor notifications@github.com, wrote:
Yes, for the API Key I'm using, I have the following APIs enabled (ends with -JFbc) Google Maps Geocoding API Google Maps Javascript API Google Maps Directions API Static Maps API Google Maps Distance Matrix API My referrers are set to: .calendar.ochsner.org/ .calendar.ochsner.local/ — You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.
You're good to go.
Thanks, think I got the issue.
The error is "API keys with referer restrictions cannot be used with this API." - so your API key can not have any referee restrictions set on it, otherwise the Geocoding API won't work.
I've tried it with one of my keys, that doesn't have a url restriction, and then it works. (I've put your key back in setting, you can remove me as an admin/user)
Could you give that a try?
Great! That fixed the issue. Please make sure to add that to your documentation.
I've tested the plugin and it's now giving me the correct coordinates after a "Save and Continue".
Happy to hear that! Will be adding a warning about this to the docs asap.
Thanks for sticking with me on this and good luck with your project!
Notice about the API & exception added to readme.
Just purchased your plugin today -- so that's a good start. However, my lat/long fields are not populating after I enter my address information. This is my process:
But this is not supposed to be a manual process, correct? I think the idea is to use the address to find the correct pin location? I swear that your plugin was working properly when I first installed it months ago. I'm not seeing any errors in the Control Panel or in my web console. I can give you access to my CP if you'd like to check it out.