Skip to content

Commit 88a7ba2

Browse files
add OpenStreetMap geocoder example
1 parent d2d2154 commit 88a7ba2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-2015 codingsince1985 / Jerry Zhao
3+
Copyright (c) 2014-2016 codingsince1985 / Jerry Zhao
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ This product is designed to open to any Geocoding service. Based on it,
1010
- [Nominatim Search](http://open.mapquestapi.com/nominatim/)
1111
- [Open Geocoding](http://open.mapquestapi.com/geocoding/)
1212
+ [OpenCage](http://geocoder.opencagedata.com/api.html)
13-
+ [OpenStreetMap](https://wiki.openstreetmap.org/wiki/Nominatim)
1413
+ [HERE](https://developer.here.com/rest-apis/documentation/geocoder)
1514
+ [Bing](https://msdn.microsoft.com/en-us/library/ff701715.aspx)
1615
+ [Mapbox](https://www.mapbox.com/developers/api/geocoding/)
16+
+ [OpenStreetMap](https://wiki.openstreetmap.org/wiki/Nominatim)
1717

1818
clients are implemented in ~50 LoC each.
1919

@@ -32,6 +32,7 @@ import (
3232
"github.com/codingsince1985/geo-golang/mapquest/open"
3333
"github.com/codingsince1985/geo-golang/opencage"
3434
"github.com/codingsince1985/geo-golang/mapbox"
35+
"github.com/codingsince1985/geo-golang/openstreetmap"
3536
)
3637

3738
const addr = "Melbourne VIC"
@@ -58,6 +59,9 @@ func main() {
5859

5960
// Mapbox
6061
try(mapbox.Geocoder("YOUR_ACCESS_TOKEN"))
62+
63+
// OpenStreetMap
64+
try(openstreetmap.Geocoder())
6165
}
6266

6367
func try(geocoder geo.Geocoder) {
@@ -96,6 +100,10 @@ Address of (-37.816742,144.964463) is 46 Elizabeth St, Melbourne, VIC 3000
96100
// Mapbox
97101
Melbourne VIC location is {-37.8142 144.9632}
98102
Address of (-37.816742,144.964463) is Bankwest ATM, 43-55 Elizabeth St, 3000 Melbourne, Australia
103+
104+
// OpenStreetMap
105+
Melbourne VIC location is {-37.8142175 144.9631608}
106+
Address of (-37.816742,144.964463) is Bankwest, Elizabeth Street, Melbourne, City of Melbourne, Greater Melbourne, Victoria, 3000, Australia
99107
```
100108
License
101109
==

0 commit comments

Comments
 (0)