Depends on: drakma, cl-json, s-xml
Repository: https://github.com/nlamirault/cl-geonames
License: LLGPL
Quick assessment (2024-10-20)
- Doesn't work as-is, since in 2011 the service switched to Application Identification for free GeoNames Web Services.
- For this assessment, the username is demo_by_david_mullen, which is the maximum length (20 characters).
- Lines 26–28 of specials.lisp: Change ws.geonames.org to api.geonames.org.
- Lines 30–37 of specials.lisp: Append username=demo_by_david_mullen& to the URI.
- Lines 23–43 of api.lisp: For JSON, append to the path, instead of using a query parameter.
- Line 33 of api.lisp: Probably want :preserve-uri t here for drakma:http-request.
https://secure.geonames.org/timezoneJSON?lat=47.01&lng=10.2&username=demo_by_david_mullen
For metering purposes, you are advised to create a GeoNames user account:
After creating the account, you need to click the link to enable the free service.
Are we there yet? I'm lost and in dire need of geospatial services
For example, to search a postal code:
? (cl-geonames:geo-postal-code-search "97233" "")
(:|geonames| (:|totalResultsCount| "3")
(:|code| (:|postalcode| "97233") (:|name| "Portland")
(:|countryCode| "US") (:|lat| "45.51421") (:|lng| "-122.49849")
((:|adminCode1| :ISO3166-2 "OR") "OR") (:|adminName1| "Oregon")
(:|adminCode2| "051") (:|adminName2| "Multnomah") :|adminCode3|
:|adminName3|)
(:|code| (:|postalcode| "972 33") (:|name| "Luleå")
(:|countryCode| "SE") (:|lat| "65.58415") (:|lng| "22.15465")
((:|adminCode1| :ISO3166-2 "BD") "BD") (:|adminName1| "Norrbotten")
(:|adminCode2| "2580") (:|adminName2| "Luleå") :|adminCode3|
:|adminName3|)
(:|code| (:|postalcode| "97233") (:|name| "Schoelcher")
(:|countryCode| "MQ") (:|lat| "14.61774") (:|lng| "-61.099")
(:|adminCode1| "MQ") (:|adminName1| "Martinique")
(:|adminCode2| "972") (:|adminName2| "Martinique")
(:|adminCode3| "9721")
(:|adminName3| "Arrondissement de Fort-de-France")))
Or, to get timezone information:
? (cl-geonames:geo-timezone "44.8391224692125" "-0.585060840409772")
(:|geonames|
((:|timezone| :|tzversion| "tzdata2024a") (:|countryCode| "FR")
(:|countryName| "France") (:|lat| "44.8391224692125")
(:|lng| "-0.585060840409772") (:|timezoneId| "Europe/Paris")
(:|dstOffset| "2.0") (:|gmtOffset| "1.0") (:|rawOffset| "1.0")
(:|time| "2024-10-20 20:45") (:|sunrise| "2024-10-20 08:24")
(:|sunset| "2024-10-20 19:08")))
See more examples on the project page [archived snapshot].
Topics: Geospatial, Web API