Registry / maps / apple-maps-server-sdk

apple-maps-server-sdk

JSON →
library1.1.9jsnpmunverified

An SDK for the Apple Maps Server API that provides geocoding, estimated time of arrival, location search, and other MapKit JS Web APIs in JavaScript and TypeScript. Version 1.1.9 ships TypeScript definitions and works in Node.js and browser environments. Unlike generic mapping SDKs, this package is purpose-built for Apple Maps, offering native integration with Apple's server-side services. The package is actively maintained on GitHub and follows semantic versioning. It is the only dedicated npm package for the Apple Maps Server API, simplifying authentication and request handling.

npm install apple-maps-server-sdk
INSTALL
IMPORT
SIG · APPLE-MAPS-SERVER-
A
apple-maps-server-sdk
mapsjavascriptv1.1.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AppleMaps
import AppleMaps from 'apple-maps-server-sdk'
const AppleMaps = require('apple-maps-server-sdk')
The default export is the AppleMaps class. For CommonJS, you must use require('apple-maps-server-sdk').default.
GeocodeResponse
import type { GeocodeResponse } from 'apple-maps-server-sdk'
import { GeocodeResponse } from 'apple-maps-server-sdk'
Type imports should use `import type` to avoid runtime side effects. The GeocodeResponse type is exported for TypeScript users.
ETAOptions
import type { ETAOptions } from 'apple-maps-server-sdk'
import { ETAOptions } from 'apple-maps-server-sdk'
Type imports should use `import type`. ETAOptions defines the parameters for ETA requests.

Shows how to instantiate the SDK with an authorization token and perform a geocode lookup.

import AppleMaps from 'apple-maps-server-sdk'; const appleMaps = new AppleMaps({ authorizationToken: process.env.APPLE_MAPS_TOKEN ?? '', }); appleMaps.geocode({ q: '1600 Pennsylvania Avenue NW, Washington, D.C., 20500', }) .then((response) => { console.log(response); }) .catch((err) => { console.error(err); });
Debug
Known issues
gotchaCommonJS users must use require('apple-maps-server-sdk').default instead of require('apple-maps-server-sdk'). The main export is an ES module default export.
fix
Use require('apple-maps-server-sdk').default or switch to ES modules.
affects: *
gotchaAuthorization token must be a valid Apple Maps Server API token obtained from your Apple Developer account. An invalid token will result in 403 errors.
fix
Ensure the token is correctly generated with the proper key ID, team ID, and service ID.
affects: *
deprecatedThe 'mapsId' parameter in geocode requests is deprecated and may be removed in a future version.
fix
Use 'q' for query-based geocoding instead.
affects: >=1.1.0
gotchaThe SDK does not support browser environments without a bundler like webpack or esbuild because it uses Node.js built-in modules (e.g., crypto).
fix
Use a bundler that can polyfill Node.js modules or use the package only in Node.js.
affects: *
gotchaTypeScript users must use `import type` for type imports to avoid runtime errors, as the package exports types as runtime values.
fix
Use `import type { ... } from 'apple-maps-server-sdk'` for type-only imports.
affects: *
Errors
Common errors & fixes
Cannot find module 'apple-maps-server-sdk' or its corresponding type declarations.
The package is not installed, or TypeScript cannot locate the types.
fix
Run `npm install apple-maps-server-sdk` and ensure tsconfig.json includes 'node_modules/@types' or the package itself has types.
TypeError: apple_maps_server_sdk_1.default is not a constructor
Mixing ES import syntax with CommonJS require without accessing the default export.
fix
Use `import AppleMaps from 'apple-maps-server-sdk'` or `const AppleMaps = require('apple-maps-server-sdk').default`.
Error: Authorization token is required
The AppleMaps constructor was called without an `authorizationToken` option.
fix
Pass a valid token string as `authorizationToken` when instantiating AppleMaps.
Upgrade
Version history
1.1.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
30
Resources
apple-maps-server-sdk — npm install apple-maps-server-sdk · libregistry