-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Places API (New) #894
Comments
There is nothing for us to do to support those new APIs, the classes used to interact with the new APIs share the As far as I know, the maps team is in the process of rebuilding the Places API Services and corresponding JS classes. The new API started off as just the REST API (iirc, the new |
But if the API's are switching from being GET to being POST, why is there not something you can do? The deadline for when the Places API (Legacy) is officially deprecated was 1st of March. Would be really nice to have the package be compatible with the new and updated API along with updated pricing structures. Just as mentioned by @jz-notion. Otherwise we would have to move from this package and integrate with the API directly. |
I don't know what else to tell you. This loader is 100% "compatible" with the new places API, meaning you can choose to use either the legacy or the new places library – both versions exist together in the It's on the application developers to actually use the new API – that is not going to happen automatically, since it requires developers to use completely different classes (for example using Here is an article detailing the migration process from legacy to new places API: https://developers.google.com/maps/documentation/javascript/places-migration-overview Is there anything else I can do to clear that up? |
That actually clears up quite a bit, thank you. The documentation is not super clear on how to migrate to the new version using classes. Thanks for clearing up the misunderstanding, my intent was not for me to be able to do nothing and for you to solve the "problem". |
I have issue with the actual API not working for me at all. I documented it here and someone in the comments said it's broken for react js loader as well. Can anyone confirm it's broken for them as well? Or is my example incorrect? https://stackoverflow.com/questions/79482008/google-places-api-new-autocomplete-not-working Example code from above thread import { Loader } from '@googlemaps/js-api-loader';
const loader = new Loader({
apiKey: 'MY_API_KEY',
version: 'beta', // weekly, alpha or beta (none work completely)
libraries: ['places'] // should I do this or import library below?
});
async function initMap() {
// Request needed libraries.
const [{ Map }, { AdvancedMarkerElement }] = await Promise.all([
loader.importLibrary("marker"),
loader.importLibrary("places"),
]);
// Initialize the map.
map.value = new google.maps.Map(document.getElementById("map"), {
center: { lat: -34.397, lng: 150.644 },
zoom: 9,
mapId: "4504f8b37365c3d0",
mapTypeControl: false,
});
let placeAutocomplete =
new google.maps.places.PlaceAutocompleteElement({
componentRestrictions: {country: ['us']},
});
placeAutocomplete.id = "pac-input";
let card = document.getElementById("pac-map");
card.appendChild(placeAutocomplete);
placeAutocomplete.addEventListener('gmp-placeselect', async ({ place }) => {
console.log(place); // NEVER MAKES IT HERE IN ALPHA
});
}
onMounted(async () => {
initMap();
}); |
@nbyloff Please note that all web-components are all still in alpha/beta and not yet in the stable version. Here are a couple of notes to help you fix your problem (also a working example):
|
@usefulthink Wow thanks for pointing that out. Can't believe there's only an alpha version and they already disabled generating legacy keys for the old API. But I am catching the proper event on alpha version now! Going to test a handful of other places API calls now, I might have to wait until there's a stable version. Thanks again! |
I think the new Autocomplete Data API should already be out of beta. So you could use that to create an Autocomplete widget in your framework of choice yourself. |
Is your feature request related to a problem? Please describe.
Google Maps launched a new Places API along with updated pricing structure. The previous API is now marked as
Places API (Legacy)
. This loader does not appear to support the new API & features.Describe the solution you'd like
Please add support for
Places API (New)
.Describe alternatives you've considered
Integrate with the new API directly.
The text was updated successfully, but these errors were encountered: