- Saved searches
- Use saved searches to filter your results more quickly
- License
- googlemaps/google-maps-services-js
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Платформа Google Карт
- Maps JavaScript API
- Начало работы
- Начало работы с платформой Google Карт
- Ваша первая карта с маркером
- Настройка стиля карты
- Информационные окна для маркеров
- Возможности
- Типы карт
- Локализация
- Маркеры
- Элементы управления
- События
- Наложение WebGL
- Информационные окна
- Фигуры
- Собственные наложения
- Наземные наложения
- Слой данных
- Собственные стили
- Наклон и ориентация
- Кластеризация маркеров
- Тепловые карты
- Библиотеки
- Обзор библиотек
- Библиотека Drawing
- Библиотека Geometry
- Библиотека Places
- Библиотека локального контекста (бета)
- Библиотека Visualization
- Службы
- Служба Directions
- Служба Distance Matrix
- Служба Elevation
- Служба Geocoding
- Служба Maximum Zoom Imagery
- Служба Street View
- Примеры приложений
- Поиск мест
- Ночной режим
- Настройка значков маркера
- Собственные наложения
- Слой загруженности дорог
- Наклон и ориентация карты
- Справка и поддержка
- Stack Overflow
- Система отслеживания ошибок
- Статус платформы
- Поддержка
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Node.js client library for Google Maps API Web Services
License
googlemaps/google-maps-services-js
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.4.2 to 20.4.4. — [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) — [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) — updated-dependencies: — dependency-name: «@types/node» dependency-type: direct:development update-type: version-update:semver-patch . Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot]
Git stats
Files
Failed to load latest commit information.
README.md
Node.js Client for Google Maps Services
This library is a refactor of a previous version published to @google/maps. It is now being published to @googlemaps/google-maps-services-js.
Use Node.js? Want to geocode something? Looking for directions? This library brings the Google Maps API Web Services to your Node.js application.
The Node.js Client for Google Maps Services is a Node.js Client library for the following Google Maps APIs:
Keep in mind that the same terms and conditions apply to usage of the APIs when they’re accessed through this library.
This library is designed for server-side Node.js applications. Attempting to use it client-side, in either the browser or any other environment like React Native, may in some cases work, but mostly will not. Please refrain from reporting issues with these environments when attempting to use them, since server-side Node.js applications is the only supported environment for this library. For other environments, try the Maps JavaScript API, which contains a comparable feature set, and is explicitly intended for use with client-side JavaScript.
$ npm install @googlemaps/google-maps-services-js
Below is a simple example calling the elevation method on the client class.
Import the Google Maps Client using Typescript and ES6 module:
import Client> from "@googlemaps/google-maps-services-js";
Alternatively using JavaScript without ES6 module support:
const Client> = require("@googlemaps/google-maps-services-js");
Now instantiate the client to make a call to one of the APIs.
const client = new Client(>); client .elevation( params: locations: [ lat: 45, lng: -110 >], key: "asdf", >, timeout: 1000, // milliseconds >) .then((r) => console.log(r.data.results[0].elevation); >) .catch((e) => console.log(e.response.data.error_message); >);
The generated reference documentation can be found here. The TypeScript types are the authoritative documentation for this library and may differ slightly from the descriptions.
In order to run the end-to-end tests, you’ll need to supply your API key via an environment variable.
$ export GOOGLE_MAPS_API_KEY=AIza-your-api-key $ npm test
This section discusses the migration from @google/maps to @googlemaps/google-maps-services-js and the differences between the two.
Note: The two libraries do not share any methods or interfaces.
The primary difference is @google/maps exposes a public method that takes individual parameters as arguments while @googlemaps/google-maps-services-js exposes methods that take params , headers , body , instance (see Axios). This allows direct access to the transport layer without the complexity that was inherent in the old library. Below are two examples.
const googleMapsClient = require('@google/maps').createClient( key: 'your API key here' >); googleMapsClient .elevation( locations: lat: 45, lng: -110> >) .asPromise() .then(function(r) console.log(r.json.results[0].elevation); >) .catch(e => console.log(e); >);
const client = new Client(>); client .elevation( params: locations: [ lat: 45, lng: -110 >], key: process.env.GOOGLE_MAPS_API_KEY >, timeout: 1000 // milliseconds >, axiosInstance) .then(r => console.log(r.data.results[0].elevation); >) .catch(e => console.log(e); >);
The primary differences are in the following table.
Old | New |
---|---|
Can provide params | Can provide params, headers, instance, timeout (see Axios Request Config) |
API key configured at Client | API key configured per method in params object |
Retry is supported | Retry is configurable via axios-retry or retry-axios |
Does not use promises by default | Promises are default |
Typings are in @types/googlemaps | Typings are included |
Does not support keep alive | Supports keep alive |
Does not support interceptors | Supports interceptors |
Does not support cancelalation | Supports cancellation |
Premium Plan Authentication
Authentication via client ID and URL signing secret is provided to support legacy applications that use the Google Maps Platform Premium Plan. The Google Maps Platform Premium Plan is no longer available for sign up or new customers. All new applications must use API keys.
const client = new Client(>); client .elevation( params: locations: [ lat: 45, lng: -110 >], client_id: process.env.GOOGLE_MAPS_CLIENT_ID, client_secret: process.env.GOOGLE_MAPS_CLIENT_SECRET >, timeout: 1000 // milliseconds >) .then(r => console.log(r.data.results[0].elevation); >) .catch(e => console.log(e.response.data.error_message); >);
This library is community supported. We’re comfortable enough with the stability and features of the library that we want you to build real production applications on it. We will try to support, through Stack Overflow, the public surface of the library and maintain backwards compatibility in the future; however, while the library is in version 0.x, we reserve the right to make backwards-incompatible changes. If we do remove some functionality (typically because better functionality exists or if the feature proved infeasible), our intention is to deprecate and give developers a year to update their code.
If you find a bug, or have a feature suggestion, please log an issue. If you’d like to contribute, please read How to Contribute.
About
Node.js client library for Google Maps API Web Services
Платформа Google Карт
Отправить отзыв Оптимизируйте свои подборки Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Maps JavaScript API
Создавайте динамические, интерактивные, персонализированные карты и геопространственные объекты для своих веб-приложений.
Начало работы
Начало работы с платформой Google Карт
Ознакомьтесь с кратким руководством платформы Google Карт. Зарегистрируйтесь, сгенерируйте ключ API и приступайте к работе.
Ваша первая карта с маркером
Настройка стиля карты
Задайте все необходимые параметры карты, включая дороги, географические объекты и объекты инфраструктуры.
Информационные окна для маркеров
Возможности
Типы карт
Локализация
Маркеры
Элементы управления
События
Наложение WebGL
Информационные окна
Фигуры
С помощью встроенных функций на карте можно рисовать различные фигуры, в том числе ломаные линии и многоугольники.
Собственные наложения
Наземные наложения
Слой данных
Собственные стили
Наклон и ориентация
Кластеризация маркеров
Тепловые карты
Библиотеки
Вызывайте дополнительные библиотеки в загрузочной строке Maps JS API, чтобы добавить в карту другие функции.
Обзор библиотек
Библиотека Drawing
Библиотека Geometry
Библиотека Places
Ищите места рядом, включайте для них поисковые подсказки, получайте фотографии и информацию о выбранных местах.
Библиотека локального контекста (бета)
Библиотека Visualization
Службы
Служба Directions
Служба Distance Matrix
Служба Elevation
Служба Geocoding
Служба Maximum Zoom Imagery
Служба Street View
Примеры приложений
Поиск мест
Ночной режим
Настройка значков маркера
Собственные наложения
Слой загруженности дорог
Наклон и ориентация карты
Справка и поддержка
Stack Overflow
Обращайтесь за помощью, помогайте другим, создавайте репутацию Карт.
Система отслеживания ошибок
Сообщайте об ошибках или отправляйте запросы на добавление функций.
Статус платформы
Узнавайте об инцидентах и сбоях платформы.
Поддержка
Обращайтесь за помощью к команде платформы Google Карт.
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons «С указанием авторства 4.0», а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2023-06-26 UTC.