mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add geocoder service
This commit is contained in:
14
app/assets/javascripts/darkswarm/services/geocoder.js.coffee
Normal file
14
app/assets/javascripts/darkswarm/services/geocoder.js.coffee
Normal file
@@ -0,0 +1,14 @@
|
||||
# Usage:
|
||||
# Geocoder.geocode address, (results, status) ->
|
||||
# if status == Geocoder.OK
|
||||
# console.log results[0].geometry.location
|
||||
# else
|
||||
# console.log "Error: #{status}"
|
||||
|
||||
Darkswarm.service "Geocoder", ->
|
||||
new class Geocoder
|
||||
OK: google.maps.GeocoderStatus.OK
|
||||
|
||||
geocode: (address, callback) ->
|
||||
geocoder = new google.maps.Geocoder()
|
||||
geocoder.geocode {'address': address}, callback
|
||||
Reference in New Issue
Block a user