我有一个地址数据库,所有地理编码.
在给定lat,lng的某个半径范围内查找数据库中所有地址的最佳方法是什么?
换句话说,用户输入(lat,lng)某个位置,我们返回来自我们数据库的所有记录,这些记录位于给定位置的10,20,50 ......等英里范围内.
它不一定非常精确.
我使用MySQL DB作为后端.
如何轻松自定义OpenLayers地图控件?或者至少,我如何最小化控件的高度?
谢谢.
PS.有没有CSS覆盖?
HI需要能够选择状态并给出边界状态列表.有没有人知道或已经为此做过代码?
如果我必须自己编写,最好的方法是什么 - 可能是边框的mysql数据库(每行两个状态列),然后选择匹配?
编辑:这是一个开始 - 边界列表:http://www.econ.umn.edu/~holmes/data/BORDLIST.html
我想从谷歌获得地理编码,而我过去常常使用API的V2.Google在json中发送了一个非常好的信息,准确性,请参考此处:http://code.google.com/intl/fr-FR/apis/maps/documentation/javascript/v2/reference.html#GGeoAddressAccuracy
在V3中,Google似乎并没有向我发送完全相同的信息.有一个数组"adresse_component",如果准确性更好,它看起来更大,但不完全.例如,我对街道号码有一个请求精度,数组的大小为8.另一个查询是路由的准确性,因此精度较低,但是数组的大小仍为8,因为有一行'sublocality',这不会出现在第一种情况下.
好的,结果,谷歌发送的数据"类型"具有"最佳"准确性.这个类型在这里:http://code.google.com/intl/fr-FR/apis/maps/documentation/geocoding/#Types 但是,没有真正的顺序,如果我不比postal_code更好的结果,我不知道该怎么做.
那么,我怎样才能获得相当于V2精度的等价物,而不是一些愚蠢和可怕的代码呢?
我的用户可能位于世界任何地方,将会出现一个文本框,其中他们可以输入他们的地址.在大多数情况下,我认为他们将与他们输入的任何地址在同一个国家.
我想通过区域偏差来帮助Google Map API做出更好的猜测.有没有办法告诉谷歌地区偏离请求的来源?或者,当我拨打网络服务电话时,如何将此信息提供给Google(例如,将IP地址转换为国家/地区信息)?
谢谢.
我正在尝试使用带有Python和JSON的Google Maps地理编码器,但一直被告知我有一个错误的请求:
add = "Buckingham Palace, London, SW1A 1AA"
geocode_url = "https://maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false®ion=uk" % add
print geocode_url
req = urllib2.urlopen(geocode_url)
jsonResponse = json.loads(f.read())
pprint.pprint(nest)
Run Code Online (Sandbox Code Playgroud)
这失败了urllib2.HTTPError: HTTP Error 400: Bad Request.
但如果我只是复制和粘贴
https://maps.googleapis.com/maps/api/geocode/json?address=Buckingham%20Palace,%20London,%20SW1A%201AA&sensor=false®ion=uk
Run Code Online (Sandbox Code Playgroud)
进入浏览器栏,它工作正常.
我的要求有什么问题?
有没有办法通过nominatim从请求中获得对象的道路类型?
例如
确实为我提供了大量的信息.然而,在地址居住的道路上没有信息.想获得类似的东西:乡村道路甚至只是等级*N*(其中N代表等级的水平.)我希望我正在寻找的东西是可以理解的:)提前谢谢!
我正在使用rails geocoder gem并在我的位置模型中使用以下内容
geocoded_by :address
Run Code Online (Sandbox Code Playgroud)
但我的位置有其他属性,如城市,州和国家,这些属性会影响输出的地址.
如何通过所有4个输入进行地理编码?我尝试使用所有四个属性创建一个full_address变量,但我不知道它实际上去了哪里.
谢谢!
我想使用Mapquest地理编码API.在浏览器中打开此URL将返回包含结果的XML:
http://open.mapquestapi.com/nominatim/v1/search?format=xml&q=Wangaratta
<searchresults timestamp="Mon, 07 Apr 14 07:30:18 +0000" attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright" querystring="Wangaratta" polygon="false" exclude_place_ids="6310497,2436827371,2461158662,51900617,41796980,50259050,2461159039,41201823,2466076780" more_url="http://open.mapquestapi.com/nominatim/v1/search?format=xml&exclude_place_ids=6310497,2436827371,2461158662,51900617,41796980,50259050,2461159039,41201823,2466076780&accept-language=en-AU,en;q=0.8,en-US;q=0.6,fr;q=0.4&q=Wangaratta">
<place place_id="6310497" osm_type="node" osm_id="662026831" place_rank="18" boundingbox="-36.3962509,-36.3162509,146.2830914,146.3630914" lat="-36.3562509" lon="146.3230914" display_name="Wangaratta, Victoria" class="place" type="town" importance="0.48506868719577" icon="http://open.mapquestapi.com/nominatim/v1/images/mapicons/poi_place_town.p.20.png"/>
<place place_id="2436827371" osm_type="relation" osm_id="2562060" place_rank="20" boundingbox="-36.40642,-36.3243,146.25683,146.37104" lat="-36.36536" lon="146.311987722222" display_name="Wangaratta, Victoria, Australia" class="boundary" type="administrative" importance="0.35" icon="http://open.mapquestapi.com/nominatim/v1/images/mapicons/poi_boundary_administrative.p.20.png"/>
<place place_id="2461158662" osm_type="way" osm_id="220567499" place_rank="26" boundingbox="-36.3508096,-36.3504818,146.310831,146.3127119" lat="-36.3508096" lon="146.3127119" display_name="Rowan Street, Wangaratta, Victoria, 3677" class="highway" type="tertiary" importance="0.2"/>
<place place_id="51900617" osm_type="way" osm_id="52507281" place_rank="26" boundingbox="-36.3570551,-36.3551449,146.3200286,146.3228768" lat="-36.3558843" lon="146.3217743" display_name="Ovens Street, Wangaratta, Victoria, 3676, Australia" class="highway" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用(geocoder gem),将语言环境适当地设置为客户端IP地址.request.location
这就是我所拥有的:
应用程序/控制器/ application_controller.rb
before_action :set_locale
private
def set_locale
# get location with geocoder
location = request.location
# set locale through URL
if params.has_key?(:locale)
I18n.locale = params[:locale] || I18n.default_locale
# set locale through user preference
elsif current_user && current_user.locale.present?
I18n.locale = current_user.try(:locale) || I18n.default_locale
# set locale through geocoder detection of location
elsif location.present? && location.country_code.present? && I18n.available_locales.include?(location.country_code)
if location.country_code.include? "-"
I18n.locale = location.country_code
else
I18n.locale = location.country_code.downcase
end
# set locale through HTTP …Run Code Online (Sandbox Code Playgroud) geocoding ×10
google-maps ×3
algorithm ×1
api ×1
bash ×1
curl ×1
google-api ×1
javascript ×1
json ×1
locale ×1
maps ×1
nominatim ×1
openlayers ×1
php ×1
python ×1
ruby ×1
search ×1