@simple-nominatim/core
v0.1.4
Published
A lightweight library to make requests to the Nominatim API from Node programs
Downloads
1
Maintainers
Readme
This is a library designed to facilitate requests to the Nominatim API.
It is part of the Simple Nominatim monorepo. You can also search for the @simple-nominatim/core
package on npm.
Disclaimers
The utilization of this project is governed by the Nominatim Usage Policy (aka Geocoding Policy). Please adhere to fair usage practices as outlined by the OSMF Operations Working Group.
The owner and contributors of the Simple Nominatim project, including its libraries, assume no responsibility for any misuse.
Installation
Simple Nominatim currently only supports the Search, Reverse and Status endpoints.
$ npm install -g @simple-nominatim/core
Usage
Reverse Endpoint
Geocode
Use the geocodeReverse
method directly in your code:
import { geocodeReverse } from '@simple-nominatim/core'
const results = await geocodeReverse({ latitude: '37.4219999', longitude: '-122.0840575' }, { format: 'jsonv2' })
Parameters
latitude
: Specify the latitude of the coordinate.- This is a required option.
longitude
: Specify the longitude of the coordinate.- This is a required option.
Options
email
: Specify an appropriate email address when making large numbers of identified request.format
: Define the output format.- This is a required option.
- Values include
xml
,json
,jsonv2
,geojson
, andgeocodejson
.
Search Endpoint
Free-form query
Use the freeFormSearch
method directly in your code:
import { freeFormSearch } from '@simple-nominatim/core'
const results = await freeFormSearch({ query: '1600 Amphitheatre Parkway, Mountain View, CA, USA' }, { format: 'jsonv2' })
Parameters
query
: A free-form query string to search.- This is a required option.
Options
email
: Specify an appropriate email address when making large numbers of identified request.format
: Define the output format.- This is a required option.
- Values include
xml
,json
,jsonv2
,geojson
, andgeocodejson
.
limit
: Specify the maximum number of returned results. Cannot be more than 40.
Structured query
Use the structuredSearch
method directly in your code:
import { structuredSearch } from '@simple-nominatim/core'
const results = await structuredSearch({ country: 'USA' }, { format: 'jsonv2' })
Parameters
amenity
: Specify the name or type of point of interest (POI).city
: Specify the city name.country
: Specify the country name.- This is a required option.
county
: Specify the county name.postalcode
: Specify the postal code.state
: Specify the state name.street
: Specify the house number and street name.
Options
email
: Specify an appropriate email address when making large numbers of identified request.format
: Define the output format.- This is a required option.
- Values include
xml
,json
,jsonv2
,geojson
, andgeocodejson
.
limit
: Specify the maximum number of returned results. Cannot be more than 40.
Status Endpoint
Service
Use the serviceStatus
method directly in your code:
import { serviceStatus } from '@simple-nominatim/core'
const results = await serviceStatus({ format: 'json' })
Options
--format
: Define the output format.- This is a required option.
- Values include
text
andjson
.
License
Simple Nominatim Core is MIT licensed.