简体   繁体   English

从RSS feed获取地理位置

[英]Get geo location from RSS feed

I am working on RSS feed and I want to display it on google map, for that I need geo location (latitude and longitude). 我正在使用RSS feed,并且想在Google地图上显示它,因为我需要地理位置(经度和纬度)。 Is there any way to get geolocation from RSS feed. 有什么方法可以从RSS feed获得地理位置信息。

Please find below example link and it output the results as below: 请在下面找到示例链接,其输出结果如下:

http://news.google.com/news?ned=us&topic=h&output=rss http://news.google.com/news?ned=us&topic=h&output=rss

[0] => Array([
        title] => With video: Marine urination outrage not stopping Afghan peace talk moves - Detroit Free Press
        [link] => http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGJ6-pSyuoJH43Om0IZipU0bYSCZg&url=http://www.freep.com/article/20120113/NEWS07/120113024/With-video-Marine-urination-outrage-not-stopping-Afghan-peace-talk-moves
        [description] =>With video: Marine urination outrage not stopping Afghan peace talk moves
        [guid] => tag:news.google.com,2005:cluster=17593988265025
        [pubDate] => Fri, 13 Jan 2012 16:14:32 GMT
    )

Thanks 谢谢

You could get the IP address of the feed's HTTP server, and then use geolocation library of service to get an approximate location of this IP address. 您可以获取源的HTTP服务器的IP地址,然后使用服务的地理位置库来获取此IP地址的大致位置。

Here is a free database which can be used with many programming environments: http://www.maxmind.com/app/city 这是一个免费的数据库,可以在许多编程环境中使用: http : //www.maxmind.com/app/city

it will return you the approximate latitude and longitude. 它将返回大致的纬度和经度。 This will be very rough. 这将是非常粗糙的。 It will give you the location of the server which is serving the feed. 它将为您提供提要的服务器的位置。

You can use these coordinates to display a google map. 您可以使用这些坐标来显示Google地图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM