Cope with the OSM NameFinder returning a result with no nearby places.
This commit is contained in:
parent
3bae3e6881
commit
bac37f29d2
1 changed files with 10 additions and 5 deletions
|
@ -91,11 +91,16 @@ private
|
||||||
place = named.elements["place/named"] || named.elements["nearestplaces/named"]
|
place = named.elements["place/named"] || named.elements["nearestplaces/named"]
|
||||||
type = named.attributes["info"].to_s.capitalize
|
type = named.attributes["info"].to_s.capitalize
|
||||||
name = named.attributes["name"].to_s
|
name = named.attributes["name"].to_s
|
||||||
distance = format_distance(place.attributes["approxdistance"].to_i)
|
if place
|
||||||
direction = format_direction(place.attributes["direction"].to_i)
|
distance = format_distance(place.attributes["approxdistance"].to_i)
|
||||||
placename = place.attributes["name"].to_s
|
direction = format_direction(place.attributes["direction"].to_i)
|
||||||
results.push({:lat => lat, :lon => lon, :zoom => zoom,
|
placename = place.attributes["name"].to_s
|
||||||
:description => "#{type} #{name}, #{distance} #{direction} of #{placename}"})
|
results.push({:lat => lat, :lon => lon, :zoom => zoom,
|
||||||
|
:description => "#{type} #{name}, #{distance} #{direction} of #{placename}"})
|
||||||
|
else
|
||||||
|
results.push({:lat => lat, :lon => lon, :zoom => zoom,
|
||||||
|
:description => "#{type} #{name}"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return { :source => "OpenStreetMap Namefinder", :url => "http://www.frankieandshadow.com/osm/", :results => results }
|
return { :source => "OpenStreetMap Namefinder", :url => "http://www.frankieandshadow.com/osm/", :results => results }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue