osmfeatures 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +33 -7
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Official client for the [MapLark OSM Features API](https://maplark.com) to get GeoJSON, FlatGeobuf, GeoParquet, or CSV from OpenStreetMap. The API gets data from dedicated postgis OSM servers separate from public Overpass.
4
4
 
5
- Query OpenStreetMap features such as buildings, streets, and POIs easily. Search for OSM features by bounding box, tags, and geometry shape and get GeoJSON back within less than 250ms (dependent on query size). No converting between formats manually. The API keeps OSM semantics intact, like tags and ways, and returns OSM features you can feed straight into Leaflet, MapLibre, OpenLayers, or any geospatial toolchain. It is backed by postgis with tiered API keys and rate limiting to keep noisy neighbours out to give you low, predictable latency for real traffic. It also has self-host path for those willing to host complex infrastructure themselves.
5
+ Query OpenStreetMap features such as buildings, streets, and POIs easily. Search for OSM features by bounding box, tags, and geometry shape and get GeoJSON back within less than 250ms (dependent on query size). No converting between formats manually. The API keeps OSM semantics intact, like tags and ways, and returns OSM features you can feed straight into Leaflet, MapLibre, OpenLayers, or any geospatial toolchain. It is backed by postgis with tiered API keys and rate limiting to keep noisy neighbours out to give you low, predictable latency for real traffic. It also has a self-host path for those willing to host complex infrastructure themselves, and Geo Agent methods for places search, opening hours, and walk or bike routing.
6
6
 
7
7
  The translation layer is very simple:
8
8
 
@@ -221,9 +221,37 @@ const usage = await client.usage();
221
221
  console.log(usage.tier, usage.usage_this_month, usage.remaining_this_month);
222
222
  ```
223
223
 
224
- ## `places_search` / `places_nearby` / `places_details`
224
+ ## Geo Agent (places and routes)
225
225
 
226
- Place discovery and lookup. Search is a bbox or `location`+`radius`. Nearby ranks one set from a point. Details refetches a search/nearby feature id (`node/123`). Search and nearby hours use each place's local timezone; optional `asOf` pins the evaluation instant.
226
+ `query()` is the generic OpenStreetMap layer: buildings, roads, park polygons, any tag and geometry shape. Geo Agent is the place and mobility layer on top of the same OSM data. You pick OSM tags (`amenity=cafe`), an area, a time, and walk or bike. The API returns coordinates, opening-hours status, nearest-first ranks, and walk or bike geometry.
227
+
228
+ These endpoints answer questions like "cafes near me", "bars open at 20:00", or "suggest a walking bar crawl in Stockholm". An AI agent or a script can call the same methods.
229
+
230
+ | Endpoint | HTTP | What it does |
231
+ | -------- | ---- | ------------ |
232
+ | `places_search` | `POST /v1/places/search` | Find places in a bounding box **or** a `location` plus `radius`. Filter with OSM tags. Optional `openNow` / `asOf` for opening hours. |
233
+ | `places_nearby` | `POST /v1/places/nearby` | "X near this point". Same tags and hours filters, ranked nearest-first by straight-line distance. |
234
+ | `places_details` | `GET /v1/places/{osm_type}/{osm_id}` | Reload one place by the id search or nearby returned (`node/123`). |
235
+ | `routes_isochrone` | `POST /v1/routes/isochrone` | Walk or bike reach polygon from an origin (how far you can get in N metres or seconds). |
236
+ | `routes_path` | `POST /v1/routes/path` | Walk or bike through stops in the order you list them. No reordering. |
237
+ | `routes_optimized_path` | `POST /v1/routes/optimized_path` | Order the stops for you (a tour from `start`). `loop` (default true) returns to start. |
238
+
239
+ Search and nearby hours use each place's local timezone. Optional `asOf` pins the evaluation instant. Routing is walk or bicycle on the OSM network (`travelMode`: `WALK` or `BICYCLE`). Car routing is not available yet.
240
+
241
+ #### Typical questions
242
+
243
+ | Prompt | SDK |
244
+ |------|-----|
245
+ | "Cafes near me" | `client.places_nearby()` or `client.places_search()` with `location` + `radius` |
246
+ | "Restaurants within 150 m of a station" | two `client.places_search()` calls, then join locally by distance |
247
+ | "Bars open at 20:00" | `client.places_search()` with `asOf`, keep `openingHours.status == "open"` |
248
+ | "Cafes within a 10-minute bike ride" | `client.routes_isochrone()` + `client.places_search()` in a covering radius + keep points inside the polygon |
249
+ | "A walking bar crawl in Stockholm" | `client.places_search()` + `client.routes_optimized_path()` (`loop: true`) |
250
+ | "Walk from my hotel to the cafe, then the office" | `client.routes_path()` with those stops in listed order |
251
+ | "Suggest a walk to a bar, a restaurant, and a cafe, no particular order" | `client.routes_optimized_path()` with `loop: false` |
252
+ | "Is the office a 20-minute walk from the apartment?" | `client.routes_isochrone()` from A, point-in-polygon for B |
253
+
254
+ ### Examples for `places_search` / `places_nearby` / `places_details`
227
255
 
228
256
  ```ts
229
257
  const origin = { lat: 59.316, lon: 18.075 };
@@ -250,9 +278,9 @@ const details = await client.places_details({ osmType: first.id });
250
278
 
251
279
  `places_details` also accepts `{ osmType: 'node', osmId: 123 }`. Hours are annotated at request time in the place's local timezone.
252
280
 
253
- ## `routes_isochrone` / `routes_path` / `routes_optimized_path`
281
+ ### Examples for `routes_isochrone` / `routes_path` / `routes_optimized_path`
254
282
 
255
- Walk or bicycle routing via `POST /v1/routes/*`. Points accept `lon` or `lng`.
283
+ Points accept `lon` or `lng`. `routes_isochrone` takes exactly one of `maxDistanceM` or `durationS`. Optional `searchBufferM` widens the highway fetch corridor.
256
284
 
257
285
  ```ts
258
286
  const origin = { lon: 18.075, lat: 59.316 };
@@ -273,6 +301,4 @@ const tour = await client.routes_optimized_path({
273
301
  });
274
302
  ```
275
303
 
276
- `routes_isochrone` takes exactly one of `maxDistanceM` or `durationS`. `routes_path` follows `stops` in listed order (no TSP). `routes_optimized_path` orders `stops` from `start`; `loop` (default true) returns to start. Optional `searchBufferM` and `travelMode` (`WALK` or `BICYCLE`).
277
-
278
304
  Read the full API reference here [https://maplark.com/developer](https://maplark.com/developer) such as the OpenAPI 2.0 HTTP docs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osmfeatures",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Get OpenStreetMap features such as buildings, roads, or points of interest from dedicated servers with a single API call in GeoJSON, FlatGeobuf, Geoparquet, and CSV formats.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",