google-geocoding-api 相关问题

Google地理编码API是Google Maps API的网络服务。 Geocoding API提供了通过HTTP请求访问地理编码器的直接方式,但必须与Google Maps结合使用。

如何将地理编码的地址信息存储到数据库

foreach(var row in data){ <script type="text/javascript" src="https://maps.googleapis.com/maps/api/geocode/[email protected](row.ADDRESS1)[email protected](row.CITY)[email protected]+CA&key=???apikey???"></script> } 将其变成几百个请求,并给出我的纬度和纵向。我需要将纬度和经度放在数据库中。 <p>我真的不在乎它是返回JSON还是XML。 </p>我找不到有关如何执行此操作的信息,我发现的大多数信息都在质疑您是否允许您进行我已经研究过的信息。我是一般编程的新手,我是C#的新手,并与Google的Apis<pre>合作 </pre> <p> </p>IM在交货呼叫中心中使用此代码,也许可以帮助您:<p> </p><code> foreach(var row in data) { string strAddr = row.ADDRESS1 + &#34;,&#34; + row.CITY; //here you&#39;ve to write the exact address you want to geo GoogleMapsDll.GeoResponse myCoordenadas = new GoogleMapsDll.GeoResponse(); myCoordenadas = GoogleMapsDll.GoogleMaps.GetGeoCodedResults(strAddr); string strLat = myCoordenadas.Results[0].Geometry.Location.Lat.ToString(); string strLong = myCoordenadas.Results[0].Geometry.Location.Lng.ToString(); System.Threading.Thread.Sleep(2000); //THIS IS AN API LIMITs //this is just an example to update your sql rows, you can use the info where you need using(SqlConnection myConnection = new SqlConnection(yourConnectionString)) { myConnection.Open(); string strQueryUpdate = &#34;UPDATE yourAddressTable SET lat = &#39;&#34; + strLat + &#34;&#39; , lon = &#39;&#34; + strLong + &#34;&#39; &#34; + &#34;WHERE yourId = &#39;&#34; + row.YourId + &#34;&#39; &#34;; SqlCommand myCommandUpdate = new SqlCommand(strQueryUpdate, myConnectionUpdate); myCommandUpdate.ExecuteNonQuery(); } } </code><p> </p>以及Geo代码的类,您的地址(我从Stackoverflow中获取,但没有链接)</question> <answer tick="true" vote="1"><code>using System.Net; using System.Runtime.Serialization; using System.Runtime.Serialization.Json; using System.Web; public class GoogleMapsDll { public class GoogleMaps { /// &lt;summary&gt; /// /// &lt;/summary&gt; /// &lt;param name=&#34;address&#34;&gt;&lt;/param&gt; /// &lt;returns&gt;&lt;/returns&gt; public static GeoResponse GetGeoCodedResults(string address) { string url = string.Format( &#34;http://maps.google.com/maps/api/geocode/json?address={0}&amp;region=dk&amp;sensor=false&#34;, HttpUtility.UrlEncode(address) ); var request = (HttpWebRequest)HttpWebRequest.Create(url); request.Headers.Add(HttpRequestHeader.AcceptEncoding, &#34;gzip,deflate&#34;); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(GeoResponse)); var res = (GeoResponse)serializer.ReadObject(request.GetResponse().GetResponseStream()); return res; } } [DataContract] public class GeoResponse { [DataMember(Name = &#34;status&#34;)] public string Status { get; set; } [DataMember(Name = &#34;results&#34;)] public CResult[] Results { get; set; } [DataContract] public class CResult { [DataMember(Name = &#34;geometry&#34;)] public CGeometry Geometry { get; set; } [DataContract] public class CGeometry { [DataMember(Name = &#34;location&#34;)] public CLocation Location { get; set; } [DataContract] public class CLocation { [DataMember(Name = &#34;lat&#34;)] public double Lat { get; set; } [DataMember(Name = &#34;lng&#34;)] public double Lng { get; set; } } } } public GeoResponse() { } } } </code><p> </p> <pre></pre>

回答 0 投票 0

`地理编码` Flutter:`locationFromAddress` 抛出“意外的空值”

/// 搜索地址并移动地图 Future _searchAddress() 异步 { 字符串查询 = _searchController.text.trim(); if (query.isEmpty) { debugPrint("搜索问题...

回答 1 投票 0

地理编码请求中的组件过滤器

以下API请求 https://maps.googleapis.com/maps/api/geocode/json?address=Sedanstra%C3%9Fe+9&components=locality%3ABerlin®ion=de&language=de&key=... 产量 { “结果...

回答 1 投票 0

修改商店的经纬度

可以使用地理编码 API 修改商店的纬度和经度吗? 通过其他API,无法实现我所需要的。 从我在文档中看到的来看,这个 API 不可能做到这一点,但我

回答 1 投票 0

不断收到类型错误:无法读取未定义的属性“formatted_address”

我创建了一个页面,可以在其中批量粘贴地址并通过 Google 地理编码 API 和 axios 对其进行地理编码。 大多数地址都会转换为相应的

回答 1 投票 0

Google 地图地理编码坐标搜索问题

我有数据集。它们是这样的。 “名称、经度、纬度” 我的代码是这样的。 def get_city(纬度, 经度, api_key): """Google 地图地理编码 API 至

回答 1 投票 0

Google 地理定位 API - 红色目的地标记

我正在学习如何使用 Google Geolocation API。我的钥匙可以告诉我纬度和经度,我得到了如图所示的确切位置的地图。但我需要的是没有...的地图

回答 1 投票 0

如何通过Google地图API获取一个国家的州列表?

有可能吗。我花了5个小时研究并没有找到解决方案。 有谁知道吗?

回答 4 投票 0

Google 地理定位 API - 红色目的地标记为

我正在学习如何使用 Google 地理定位 API。我的钥匙可以告诉我纬度和经度,我得到了如图所示的确切位置的地图。但我需要的是没有t的地图...

回答 1 投票 0

带有查询字符串的HttpClient GetAsync

我正在使用 Google 的地理编码 API。我有两种方法,一种有效,另一种无效,我似乎无法弄清楚为什么: 字符串地址 = "1400,哥本哈根,DK"; 字符串 GoogleMapsAPI...

回答 2 投票 0

Flutter Google 地图弹出窗口“提供的 Api 密钥无效”

我正在构建一个 Flutter 应用程序,并添加了一个屏幕来选择特定位置。这是该屏幕的代码: 类 EventLocationPicker 扩展 StatefulWidget { 最终字符串locationPlaceId;

回答 1 投票 0

如何使用Google地理编码API中的countryCodeIso2获取国家/地区地点?

我正在使用 https://developers.google.com/maps/documentation/geocoding/requests-geocoding https://maps.googleapis.com/maps/api/geocode/json 我的用例是这样的: 我有 ISO 2 中的国家/地区代码(2 个字符)

回答 1 投票 0

Google 地理编码 API:哥伦比亚地址问题/如何对路口地址进行地理编码?

我正在使用 Google GeoCodng API , 我在尝试对来自哥伦比亚的地址进行地理编码时遇到麻烦,例如“Carrera 8 # 27 - 06, Santa Marta, MAD, CO”,该地址意味着(哥伦比亚符号)

回答 1 投票 0

地理编码?将坐标列添加到点数据集中

如果我有一个包含行业名称和所在城市的数据集,有没有办法可以从谷歌地图自动获取地址或坐标?我尝试询问 ChatGPt,后者告诉我...

回答 1 投票 0

System.Text.Json.JsonException:'JSON 值无法转换为 System.Collections.Generic.List`1

我正在尝试构建一个 WPF 应用程序以将假日详细信息存储在 SQL Server 数据库中。我向最终用户请求地址并尝试对地址进行地理编码。为此,我发出一个网络请求...

回答 1 投票 0

由于无法解释的安全问题,Geokit Rails 地理编码在 Heroku(本地工作)中失败

环境: 红宝石'3.2.2' gem 'geokit-rails', '~> 2.3', '>= 2.3.1' gem 'rails', '~> 7.1.2' 生产环境:Heroku 细节 我有一个 Property() 模型,可以在 property_addr 更新后进行地理编码...

回答 1 投票 0

当我的国家/地区包含在 Google 地图的限制区域中时,如何获取 API 密钥?

我是一名来自越南的学生,过去几个月正在使用 Google Maps API 进行一个项目,其中包括阅读 API 文档的时间。随着截止日期的临近,我尝试...

回答 1 投票 0

Google 反向地理编码,从 latlng 获取城市/国家

目前我正在向 https://maps.googleapis.com/maps/api/geocode/json?key=API_KEY&latlng=48.866667,2.333333 发出 API 请求,其中 latlng 是法国巴黎的地理点。什么过滤器...

回答 3 投票 0

无法在React Native应用程序中使用Google地理编码API

我正在尝试在我的反应本机应用程序中实现谷歌的地理编码以进行反向地理编码,我想在带有捆绑ID的iOS应用程序的谷歌控制台中应用限制。但是当我施加限制时...

回答 1 投票 0

使用 API 获取位置详细信息(以国家/地区作为输入)

我想通过输入国家/地区来获取城市、邮政编码、纬度和经度详细信息。有没有可用的 API 来实现这一点?向前或向后地理编码都有帮助。请帮忙。 尝试过...

回答 1 投票 0

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.