Using OpenLayers to Map Realtime Data


这是在 2007年11月2日 22:51:59 GMT 检索到的 http://mailman-viper.python-hosting.com/pipermail/users/2006-May/000006.htmlG o o g l e 缓存内容

G o o g l e 已先预览各网页,拍下网页的快照存档。

这网页可能有更新的版本,请按此查看最新版

本缓存网页可能引用了已经不存在的图片。单击此处,只查看缓存文本
请使用网址 http://www.google.com/search?q=cache:S0ENVyKWDgUJ:mailman-viper.python-hosting.com/pipermail/users/2006-May/000006.html+openlayers+realtime&hl=zh-CN&ct=clnk&cd=1&gl=cn&client=firefox-a&st_usg=ALhdy29vjCzbf4bssqqp7aRWp2ApQSl6_w 链接此页或将其做成书签。


Google 和网页作者无关,不对网页的内容负责。

这些搜索字词都已标明如下: openlayers realtime 
















[OpenLayers-Users] Using OpenLayers to Map Realtime Data


Chris Holmes
cholmes at openplans.org


Sun May 28 10:19:30 CDT 2006




Awesome.  This points the way to an open source car navigation system. 
Which will obviously be fairly crappy at first, doing just tiger data,
but if we have a good feedback loop built in, let users edit the data
really easily, it could quickly become quite good. Of course there
would need to be a number of brave users willing to get lost.

This is what will really scare the data guys, as it's where they a
majority of their money. The internet mapping stuff is small compared
to the car navigation market.

Christopher Schmidt wrote:
/> Earlier today, I had the 'joy' of taking a plane trip from Boston to
> Chicago. However, despite the cramped seat, I was able to use the time
> to make a pretty neat demo of OpenLayers capabilities that I might not
> otherwise have been able to.
>
> While flying, I set my bluetooth GPS (A Royaltek RBT-3000 -- I highly
> recommend this GPS, as it alwyas seems to get much better reception than
> my Etrex Legend) in the window of the plane. I connected to it and
> redirected the raw NMEA data to a file on the local machine.
>
> I then created a cgi script which would return the decimal latitude and
> longitude of my current location. This was actually a combination of two
> scripts: I was doing this for speed, not cleanliness.
>
> The cgi script was simple:
> #!/bin/sh
> echo -e "Content-Type: text/plain\r\n\r\n"
> python /Users/crschmidt/flying/lat2dec.py `tail -n 50 \
> /Users/crschmidt/flying.txt | grep "GPGGA" | tail -n 1`
>
> "Find the last GPGGA sentence in the tracklog, and send it into
> lat2dec.py" (not really appropriately named, as you'll see in a second).
> The python script was designed to convert from a GPGGA sentence to a
> decimal lat/lon: the code is attached.
>
> Once I had that, I opened up my local OpenLayers instance: this
> OpenLayers is specifically designed for times when I don't have internet
> access, so instead of talking to the octo.metacarta.com WMS server, it
> talks to localhost, and the WMS serves up a couple layers:
>
> http://nationalatlas.gov/mld/road00l.html -- North American Roads
> http://nationalatlas.gov/mld/bound0m.html -- Political Boundaries
> http://mappinghacks.com/data/ -- World borders
>
> (There may be some overlap in the second two.)
>
> So, the next step was to add the ability to add markers based on my
> current location. The code that did this is here:
>
> function addMarker() {
> var handler = XMLrequest();
> handler.onreadystatechange=function() {
> if (handler.readyState == 4 && handler.status == 200)
> var lonlat = handler.responseText;
> lonlat = lonlat.split(',');
> if (lonlat[1]) {
> var loc = new OpenLayers.LonLat(lonlat[0],lonlat[1]);
> markers.addMarker(new OpenLayers.Marker(loc, icon));
> }
> }
> }
> handler.open("GET", "/cgi-bin/loc.cgi", true);
> handler.send('');
> setTimeout(addMarker, '1000');
> }
>
> 'markers' in this case is a OpenLayers.Layer.Markers layer, and icon is
> an OpenLayers.icon object.
>
> After this, all I had to do was add a single call to addMarker() at the
> end of the main init() in the example OpenLayers file, and I had a live
> display of my current location on a map, moving at 450 mph.
>
> The coolest thing about this? Even if I *had* had internet, this kind of
> activity is forbidden by the ToS of the Google-Yahoo-Microsoft. This is
> a hack that you would not be able to do in the current mapping APIs.
>
> Say what you will, but this kind of thing is the reason that I want to
> have OpenLayers take over the world: I want to be able to do what I want
> with my data, and get cool things out of it, withotu worrying that some
> corporation will shut me down to protect their data license. I don't
> need street level data for this task: free data that I can set up on my
> own covers it, and provides a really nifty visual effect, without any
> cost, and without worrying about licensing concerns.
>
>
> If there's more details wanted, or help setting up something similar,
> feel free to ask/reply and I can go into more detail.
>
>
>
> ------------------------------------------------------------------------
>
> import sys
>
> GPGGA = sys.argv[1]
>
> (null, null2, latitude_in, ns, longitude_in, ew, more, more1, more2, more3, more4, more5, more6, more7, more8) = GPGGA.split(",")
>
> latitude_in = float(latitude_in)
> longitude_in = float(longitude_in)
>
> ns = "N"
> ew = "W"
>
> if ns == 'S':
> latitude_in = -latitude_in
> if ew == 'W':
> longitude_in = -longitude_in
>
> latitude_degrees = int(latitude_in/100)
> latitude_minutes = latitude_in - latitude_degrees*100
>
> longitude_degrees = int(longitude_in/100)
> longitude_minutes = longitude_in - longitude_degrees*100
>
> latitude = latitude_degrees + (latitude_minutes/60)
> longitude = longitude_degrees + (longitude_minutes/60)
>
> print "%s,%s" % (longitude,latitude)
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://mailman-viper.python-hosting.com/listinfo/users

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cholmes.vcf
Type: text/x-vcard
Size: 269 bytes
Desc: not available
Url : http://mailman-viper.python-hosting.com/pipermail/users/attachments/20060528/52f42629/cholmes.vcf










More information about the Users
mailing list





Powered by ScribeFire.

posted on 2007-12-15 08:33  StinJia  阅读(863)  评论(0编辑  收藏  举报

导航