Google maps 在哪里可以获得英国学校的lat long?
我想在我的谷歌地图上包括学校的位置,如果可能的话,我会提供一些关于学校的数据,任何帮助都会得到很大的帮助 问候 Robbie直接来自英国政府网站,包括位置。。。您可能需要自己获取位置并将其转换为lat/long(可能来自邮政编码数据) 有关其他数据集的链接,请参见,包括学生成绩和缺勤(按居住地)直接从英国政府网站获取,包括地点。。。您可能需要自己获取位置并将其转换为lat/long(可能来自邮政编码数据)Google maps 在哪里可以获得英国学校的lat long?,google-maps,Google Maps,我想在我的谷歌地图上包括学校的位置,如果可能的话,我会提供一些关于学校的数据,任何帮助都会得到很大的帮助 问候 Robbie直接来自英国政府网站,包括位置。。。您可能需要自己获取位置并将其转换为lat/long(可能来自邮政编码数据) 有关其他数据集的链接,请参见,包括学生成绩和缺勤(按居住地)直接从英国政府网站获取,包括地点。。。您可能需要自己获取位置并将其转换为lat/long(可能来自邮政编码数据) 请参阅以获取其他数据集的链接,包括学生成绩和缺勤(按居住地)如果您知道地址,您可以使用谷歌
请参阅以获取其他数据集的链接,包括学生成绩和缺勤(按居住地)如果您知道地址,您可以使用谷歌的地理编码服务。这段代码将向谷歌查询地址的纬度和经度,一旦你有了纬度和经度,你就可以在谷歌地图上标出学校的位置:
public string GeocodeAddress(string address)
{
DateTime startTime = DateTime.Now;
address = address.Replace(' ', '+');
string url = string.Format(_GEOCODE_API_TEMPLATE, address, "csv", _GOOGLE_API_KEY);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
IWebProxy proxy = WebRequest.DefaultWebProxy;
proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
request.Proxy = proxy;
StringBuilder location = new StringBuilder();
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK)
throw new System.Net.WebException( string.Format("Bad response code: {0}", response.StatusCode));
StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
char[] chars = new char[256];
int pos = 0;
int numCharsRead = 0;
while ( (numCharsRead = sr.Read(chars, 0, chars.Length)) > 0)
{
pos += numCharsRead;
location.Append(chars, 0, numCharsRead);
}
}
finally
{
if (response != null)
response.Close();
}
return location.ToString();
}
然后需要分析返回的位置:
float latitude, longitude;
float.TryParse(ar.RawGeocode.Split(',')[2], out latitude);
float.TryParse(ar.RawGeocode.Split(',')[3], out longitude);
用于查询Google API的URL为:
private const string _GEOCODE_API_TEMPLATE = "http://maps.google.com/maps/geo?q={0}&output={1}&key={2}";
键
是由Google应用和生成的,是您请求的域特有的。你可以免费获得这把钥匙(因此也可以使用这项服务),但这是有速率限制的——上次我检查时,他们限制你每天请求50K次。我忘记了你申请密钥的URL,但是如果你用谷歌搜索它,你应该不会有太多问题。。。。嘿:)谷歌有一个地理编码服务,如果你知道地址,你可以使用它。这段代码将向谷歌查询地址的纬度和经度,一旦你有了纬度和经度,你就可以在谷歌地图上标出学校的位置:
public string GeocodeAddress(string address)
{
DateTime startTime = DateTime.Now;
address = address.Replace(' ', '+');
string url = string.Format(_GEOCODE_API_TEMPLATE, address, "csv", _GOOGLE_API_KEY);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
IWebProxy proxy = WebRequest.DefaultWebProxy;
proxy.Credentials = CredentialCache.DefaultNetworkCredentials;
request.Proxy = proxy;
StringBuilder location = new StringBuilder();
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK)
throw new System.Net.WebException( string.Format("Bad response code: {0}", response.StatusCode));
StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
char[] chars = new char[256];
int pos = 0;
int numCharsRead = 0;
while ( (numCharsRead = sr.Read(chars, 0, chars.Length)) > 0)
{
pos += numCharsRead;
location.Append(chars, 0, numCharsRead);
}
}
finally
{
if (response != null)
response.Close();
}
return location.ToString();
}
然后需要分析返回的位置:
float latitude, longitude;
float.TryParse(ar.RawGeocode.Split(',')[2], out latitude);
float.TryParse(ar.RawGeocode.Split(',')[3], out longitude);
用于查询Google API的URL为:
private const string _GEOCODE_API_TEMPLATE = "http://maps.google.com/maps/geo?q={0}&output={1}&key={2}";
键
是由Google应用和生成的,是您请求的域特有的。你可以免费获得这把钥匙(因此也可以使用这项服务),但这是有速率限制的——上次我检查时,他们限制你每天请求50K次。我忘记了你申请密钥的URL,但是如果你用谷歌搜索它,你应该不会有太多问题。。。。呵呵:)