https://github.com/draperunner/kartverket-geojson
🗺 A set of tools for finding information about Norwegian places using services from Kartverket, returned on the GeoJSON
https://github.com/draperunner/kartverket-geojson
geojson kartverket norgeskart
Last synced: 4 months ago
JSON representation
🗺 A set of tools for finding information about Norwegian places using services from Kartverket, returned on the GeoJSON
- Host: GitHub
- URL: https://github.com/draperunner/kartverket-geojson
- Owner: draperunner
- Created: 2019-06-11T20:52:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-29T21:38:30.000Z (over 1 year ago)
- Last Synced: 2024-12-25T21:32:40.937Z (4 months ago)
- Topics: geojson, kartverket, norgeskart
- Language: TypeScript
- Homepage:
- Size: 55.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kartverket GeoJSON
A set of tools for finding information about Norwegian places using services from [Kartverket](https://kartverket.no/), returned on the GeoJSON format.
Install using npm. Requires Node 8 or higher.
```
npm install kartverket-geojson
```Import the functions you want
```
const { searchByCoordinates, searchByName } = require('kartverket-geojson')
// or
import { searchByCoordinates, searchByName } from 'kartverket-geojson'
```## Licensing
This library works by querying three REST services from Kartverket and combining the results into one GeoJSON result. If you are using this library, you need to accept the Kartverket's terms of use for these services.
You can find the terms here: https://kartverket.no/data/Lisens/.
Services used:
- Place names: [Kartverkets åpne API for søk etter stedsnavn](https://ws.geonorge.no/stedsnavn/v1/)
- Altitude: [Åpent API for høyde- og dybdedata fra Kartverket](https://ws.geonorge.no/hoydedata/v1/)
- Counties and municipalities: [Ã…pent API fra Kartverket for administrative enheter](https://ws.geonorge.no/kommuneinfo/v1/)## API
### searchByCoordinates
```
(coordinates: { latitude: number, longitude: number }) => Promise
```[Read about the GeoJSON Feature here](https://tools.ietf.org/html/rfc7946#section-3.2)
Call this with a set of coordinates and receive information about that geolocation.
It uses the location closest to the specifed coordinates#### Parameters
- `coordinates` (`object`): The coordinates object to search for
- `longitude` (`number`): The longitude
- `latitude` (`number`): The latitude
- `options` (`object`) [Optional]
- `epsg` (`string`) [Optional]: The EPSG code for the coordinate system to use. Default is `"4258"`.#### Example
Example call:
```
searchByCoordinates({ latitude: 60.374357, longitude: 6.1492677 })
```Example result:
```json
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [6.1492677, 60.374357, 18.34]
},
"properties": {
"county": "Vestland",
"municipality": "Kvam",
"placeNumber": 1039346,
"placeName": "Nedre Norheim"
}
}
```### searchByName
```
(name: string, options?: { limit?: number }) => Promise
```[Read about the GeoJSON FeatureCollection here](https://tools.ietf.org/html/rfc7946#section-3.3)
Search for locations with a given name.
#### Parameters
- `name` (`string`): The name of the location you are searching for
- `options` (`object`) [Optional]
- `limit` (`number`) [Optional]: The maximum number of results to fetch. Default value is 10.
- `epsg` (`string`) [Optional]: The EPSG code for the coordinate system to use. Default is `"4258"`.### Example
Example call:
```js
searchByName("Oslo S");
```Example response:
```json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.75226, 59.91067, 2.7]
},
"properties": {
"placeNumber": 369108,
"nameType": "Stasjon",
"county": "Oslo",
"municipality": "Oslo",
"placeName": "Oslo sentralstasjon"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.73353, 59.91187, 4.8]
},
"properties": {
"placeNumber": 509924,
"nameType": "Fylke",
"county": "Oslo",
"municipality": "Oslo",
"placeName": "Oslo fylke"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [10.74609, 59.91273, 10.5]
},
"properties": {
"placeNumber": 307915,
"nameType": "By",
"county": "Oslo",
"municipality": "Oslo",
"placeName": "Oslo"
}
}
]
}
```