Public API for the geo module.
Entry points:
The first two take {:only #{:pdok}} to use only the named providers. The component, GeoService, answers them through ports/GeoServiceProtocol too.
geocode! flow:
Public API for the geo module.
Entry points:
- geocode! — forward geocoding with cache-first lookup
- reverse-geocode! — reverse geocoding (no caching, coordinates not hashed)
- distance — pure Haversine distance delegate
The first two take {:only #{:pdok}} to use only the named providers. The
component, GeoService, answers them through ports/GeoServiceProtocol too.
`geocode!` flow:
1. Compute query-hash from the AddressQuery (and :only, when given)
2. If a cache is configured, attempt cache-lookup
3. On cache miss, iterate providers until one returns a result
4. Cache-store! the result (if cache configured and result non-nil)
5. Return result or nil(distance point-a point-b)Calculate the great-circle distance between two points.
Delegates to core/math/haversine-distance — this function is pure.
Args: point-a - GeoPoint map with :lat and :lng point-b - GeoPoint map with :lat and :lng
Returns: Distance in kilometres as a double.
Calculate the great-circle distance between two points. Delegates to core/math/haversine-distance — this function is pure. Args: point-a - GeoPoint map with :lat and :lng point-b - GeoPoint map with :lat and :lng Returns: Distance in kilometres as a double.
(geocode! service query)(geocode! {:keys [cache] :as service} query {:keys [only]})Forward geocode an address query.
Args: service - GeoService (from module_wiring) or a map {:providers [provider ...] :provider-names [kw ...] :cache cache-or-nil} query - AddressQuery map opts - optional {:only #{:pdok}}: the providers this call may use, by name. Results are cached per restriction.
Returns: GeoResult map or nil if no provider returned a result.
Forward geocode an address query.
Args:
service - GeoService (from module_wiring) or a map
{:providers [provider ...] :provider-names [kw ...] :cache cache-or-nil}
query - AddressQuery map
opts - optional {:only #{:pdok}}: the providers this call may use, by
name. Results are cached per restriction.
Returns:
GeoResult map or nil if no provider returned a result.(reverse-geocode! service point)(reverse-geocode! service point {:keys [only]})Reverse geocode coordinates to an address.
Args: service - GeoService or map, as for geocode! point - GeoPoint map with :lat and :lng opts - optional {:only #{:pdok}}, as for geocode!
Returns: GeoResult map or nil.
Reverse geocode coordinates to an address.
Args:
service - GeoService or map, as for geocode!
point - GeoPoint map with :lat and :lng
opts - optional {:only #{:pdok}}, as for geocode!
Returns:
GeoResult map or nil.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |