有什么好的 API 可用于根据名称确定地点的地址?
我需要根据某个地点的名称获取该地点的具体地址(或纬度/经度坐标)。
具体来说,我需要确定给定区域中超市的位置,以便我可以在谷歌地图静态地图 API 的实现中使用这些位置作为“标记”。
使用以下内容,如果您在当前显示“INSERT_LOCATION_HERE”的区域中输入特定位置,那么您将获得指定区域的谷歌地图,并在该位置处带有标记。:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|INSERT_LOCATION_HERE&sensor=false
例如(标记表示当地的 Wegmans 商店根据它的地址:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|500%20So.%20Meadow%20Street&sensor=false
如果有人知道如何在不使用谷歌地图地方 API 的情况下做到这一点,那将非常有帮助!
I need to get the specific address (or lat/long coordinates) of a place based on that place's name.
Specifically, I need to determine the location of supermarkets in a given area so that I can use those locations as 'markers' in my implementation of google maps static maps api.
Using the following, I can if you input a specific location in the area that currently says "INSERT_LOCATION_HERE", then you will get a google map of the specified area with markers at the locations.:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|INSERT_LOCATION_HERE&sensor=false
For example (the marker indicates the local Wegmans store based on its address:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|500%20So.%20Meadow%20Street&sensor=false
If anyone knows how to do this without using google maps places api, that would be extremely helpful!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想以字符串而不是图像的形式获取名称,你可以在 Google 的帮助下完成。这将与您正在使用的静态地图完美匹配。
假设您要搜索“Den Haag”...
构建这样的 URL,并解析结果:
您还可以指定输出格式:
您还可以提供坐标而不是名称,并获得全名+坐标作为回报:
由于某种原因,当您从此页面单击链接时,这些链接不起作用。我猜谷歌不接受请求中的引荐来源网址,所以只需复制并粘贴链接...这有效。
If you want to get the name as a string intead of an image, you can do it with a little help for Google. That'll match nicely with the static map that you're using.
Let's say you want to search for "Den Haag"...
Construct a URL like this, and parse the result:
You can also specify the output format:
You can also provide coordinates instead of a name, and get a full name+coordinates in return:
For some reason the links don't work when you click them from this page. I guess google doesn't accept a referrer in the request, so just copy and paste the links... That works.