Geocoding, Importing and Google Maps API Restrictions

This topic contains 17 replies, has 5 voices, and was last updated by  Paul Braun 5 years, 4 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #493038

    Paul Braun
    Expired Member
    Post count: 35

    Hi,
    We have a new v2 install, and have found that both the maps and the geocoding during import will only work when the API key is unrestricted.

    If we use “HTTP referrers” restriction, then the geocoding during import fails, but the maps still work. Manually adding/editing a listing and using “Set Address On Map” button works to set Lat/Long.

    If we use “IP addresses” restriction (with server IP), the geocoding during import works, but the maps fail. “Set Address on Map” does not work.

    Setting restrictions to “None” allows both map functions to work.

    It appears we need one key for geocoding during import, and one key for normal map usage.

    Is this a known bug?
    Is the workaround to use a different key during import?

    Thanks,
    Paul

    #493040

    Kor
    Moderator
    Post count: 16516

    Hi Paul Braun,

    Thanks for your post. This isn’t a known issue and could you share your Website WP admin access here in private reply so that I could forward this to a developer?

    Thanks!

    #493043

    Paul Braun
    Expired Member
    Post count: 35
    This reply has been marked as private.
    #493066

    Guust
    Moderator
    Post count: 29970

    I am not sure, but the problem may be with your Google Settings.
    https://wpgeodirectory.com/docs-v2/integrations/google/#manual

    Different functions use different APIs. Geocoding and Geolocation need different APIs.

    There is also a difference between “Website restrictions” and “API restrictions”.

    Try setting “API restrictions” to “off”. See image.

    Let us know, and I’ll get a developer to comment too.

    #493076

    Kiran
    Moderator
    Post count: 7069

    Hi Paul,

    It shows error “API keys with referer restrictions cannot be used with this API.” in console.

    Here are solutions:
    https://developers.google.com/maps/faq#browser-keys-blocked-error
    https://wpstorelocator.co/document/create-google-api-keys/#server-key-referrer

    Kiran

    #493222

    Paul Braun
    Expired Member
    Post count: 35

    Thanks Guust,
    Yes the keys are unrestricted for API.

    #493223

    Paul Braun
    Expired Member
    Post count: 35

    Thank you for your reply Kiran,

    So you are confirming that we do need two different keys to use maps AND geocoding with GeoDirectory. The problem is that I only see one place to enter a single key.

    Since we shouldn’t use an unrestricted key, will GeoDirectory add a second entry field for a second secured key?

    Thanks again!

    #493269

    Alex Rollin
    Moderator
    Post count: 27815

    No, you only need one key, and one field for entering that key.
    Once you have verified that an unrestricted key works, then add restrictions to it. Make sense?

    #493291

    Paul Braun
    Expired Member
    Post count: 35

    Hi Alex,
    It would make sense if a single key would work for both Geocoding AND Maps.

    But…
    Geocoding requires IP restrictions
    Maps requires Http restrictions

    One key can’t have both restrictions.
    Right?

    Thanks,
    Paul

    #493293

    Guust
    Moderator
    Post count: 29970

    Many APIs can be added to one application or project.
    Keys belong to the application, not the APIs.
    You restrict applications by HTTP or IP, not APIs.
    So restrict your application to your URL but do not restrict the APIs.

    #493294

    Guust
    Moderator
    Post count: 29970

    Many APIs can be added to one application or project.
    Keys belong to the application, not the APIs.
    You restrict applications by HTTP or IP, not APIs.
    So restrict your application to your URL but do not restrict the APIs.

    #493423

    Paul Braun
    Expired Member
    Post count: 35

    Hi Guust,
    I am not restricting by API.

    Geocoding requires IP application restrictions
    Maps requires Http application restrictions

    Google states we can set one application restriction per key.

    Can you see the problem we face now?

    Please advise,
    Paul

    #493430

    Guust
    Moderator
    Post count: 29970

    Oops.
    All I can think off is to turn of referer when you import.
    That is the only time geocoding is required.
    I never encountered that before.
    I’ll get Kiran to confirm.

    #493432

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #493438

    Paul Braun
    Expired Member
    Post count: 35

    No issues with either maps or geocoding.

    This is an unrestricted key right?

Viewing 15 posts - 1 through 15 (of 18 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount