OpenStreetMap API Lib for Nim
MIT License
nimble install openstreetmap
import openstreetmap
# Sync client.
let osm_client = OSM(timeout: 9, username: "user", password: "pass", use_prod_server: true, proxy: nil)
echo $osm_client.get_capabilities()
echo $osm_client.get_bounding_box(90.0, -90.0, 90.0, -90.0)
echo $osm_client.get_permissions()
echo $osm_client.get_changeset(61972594)
echo $osm_client.get_changeset_download(61972594)
echo $osm_client.get_changesets_bbox(90.0, -90.0, 90.0, -90.0)
echo $osm_client.get_changesets_open(true)
echo $osm_client.get_changesets_cid(@[61972594])
echo $osm_client.get_trackpoints(90.0, -90.0, 90.0, -90.0, 1)
echo $osm_client.get_notes(90.0, -90.0, 90.0, -90.0, limit=2)
echo $osm_client.get_notes_search(q="Argentina", limit=2)
# Async client.
proc test {.async.} =
let
osm_client = AsyncOSM(timeout: 9, username: "user", password: "pass", use_prod_server: true, proxy: nil)
async_resp = await osm_client.get_capabilities()
echo $async_resp
waitFor(test())
# Check the Docs for more API Calls...
You are Writing the Map for Real with this Lib!, check what you are doing!.
0.6
from Year 2018
.PDocument
.limit
key is limit: range[1..10000] = 100
as documented on the OSM Wiki.GET
start with get_*
.POST
start with post_*
.PUT
start with put_*
.DELETE
start with delete_*
.timeout
argument is on Seconds.OSM.proxy
or AsyncOSM.proxy
of Proxy
type.All OpenStreetMap API is supported, except 2 API calls:
You must provide a valid active OpenStreetMap User and Password.
No.
Yes.
Yes.
No.
Use Overpass for Reading. This is optimized for Writing speed.
Yes. You MUST give Credit to OpenStreetMap Contributors!.
Yes.
Set OSM.use_prod_server
or AsyncOSM.use_prod_server
of bool
type,
true
to use "https://api.openstreetmap.org/api/0.6/"
,
false
to use "https://master.apis.dev.openstreetmap.org/api/0.6/"
.