Posts Tagged ‘location’

Get your conky location aware

02月 19, 2010

2010-02-19-225826_188x44_scrot

Add this in your conkyrc
[cc lang="text" nowrap="0"]
${exec curl -s “http://api.hostip.info” | xpath -e “//gml:featureMember/Hostip/gml:name/text()” -q} ${exec curl -s “http://api.hostip.info” | xpath -e “//gml:featureMember/Hostip//gml:coordinates/text()” -q}
[/cc]

Hostip is well known as a service provider of the geoclue framework. It translates IP address to geolocation information. The API we use will return a GML document like
[cc lang="xml" nowrap="0"]

This is the Hostip Lookup Service
hostip

inapplicable

58.212.88.212
Nanjing
CHINA
CN

118.883,32.05

[/cc]

Because it uses ip to lookup your address, you cannot expect higher resolution and precision currently.

Using weather

02月 18, 2010

Ubuntu仓库里有个weather-util包,可以用来查看天气信息。weather工具从weather.noaa.gov网站获得天气信息,对美国的城市可以直接用名字查询,其他国家只能使用id查询。id的规则和weather.com不太相同。

中国的天气站点id可以在这个页面上查到。比如南京ZSNJ,上海浦东ZSPD。使用weather工具查询:
weather -i ZSNJ

Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 59%
Wind: from the SSW (210 degrees) at 4 MPH (4 KT)

简化操作,可以在$HOME下创建.weatherrc文件,形如
[cc lang="ini"]
[default]
ID = ZSPD
[nj]
ID = ZSNJ
[/cc]

就可以直接使用
weather

Current conditions at China (ZSPD) 31-07N 121-46E (ZSPD)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 47%
Wind: from the NE (050 degrees) at 7 MPH (6 KT) (direction variable)


weather nj

Current conditions at China (ZSNJ) 32-00N 118-48E 12M (ZSNJ)
Last updated Feb 18, 2010 – 08:00 AM EST / 2010.02.18 1300 UTC
Temperature: 35 F (2 C)
Relative Humidity: 59%
Wind: from the SSW (210 degrees) at 4 MPH (4 KT)

Location Support on Empathy

03月 1, 2009

好久不写了 ||

昨天看到了这么一篇介绍Gnome桌面上对地理位置的支持的文章(汗这句子)。地址在这里

我印象中最早的就是Gnome 2.24开始那个日期applet增加的一个地图,可以选择和设置当前的location,于是有了比较好的时区支持和天气服务。文章里还提到居然Tracker搜索也支持这么一个地理元信息,可以搜出在某个地方(是说地球上的某个地方)编辑的文件。这个很强。

然后就是Empathy对location的支持了。这个看起来很强大,截图和介绍可以看这里看这里看这里。Empathy可以用来发布你evolution的联系人地址。话说,很容易就想起来了,XMPP协议有一个地理位置的扩展。不过文中说几乎除了GoogleTalk其他都支持地理位置扩展。好家伙,这个又只能遥远地YY了。

文中提到的提供LBS的库叫做Geoclue,而在Gnome上显示地图是一个叫做libchamplain的widget。而地图,当然毫无疑问是OSM了。有兴趣的朋友可以去关注。

没了,静静等待这个Empathy变得越来越强大吧。


加关注

Get every new post delivered to your Inbox.