구글의 Location API
[IT] Ajaxian 2008/05/15 00:50 |
Gears 커뮤니티에서 Geo Location API에 대해 논의중입니다. Aaron Boodman씨에 따르면 이 API는 "W3C WebAPI 그룹에 최근에 제안되었다"고 합니다.
Aza Raskin씨는 오늘 API에 대한 자신의 생각을 다룬 Firefox에서의 지리좌표와 그 너머라는 글을 썼습니다.
제안된 API를 살펴보는 것도 꽤 재밌을 것 같습니다:
Gears 예제
이들 중 어느 하나로 통합이 되어, 브라우저에서 지리좌표 API를 사용할 수 있었으면 좋겠습니다. 한 개의 단순한 추상 객체가 수많은 훌륭한 응용프로그램으로 되는 법이죠.
from Location APIs: The Discussion on Ajaxian
Aza Raskin씨는 오늘 API에 대한 자신의 생각을 다룬 Firefox에서의 지리좌표와 그 너머라는 글을 썼습니다.
제안된 API를 살펴보는 것도 꽤 재밌을 것 같습니다:
Gears 예제
[code:js]
var geo = google.gears.factory.create('beta.geolocation');
// Get the position.
geo.getCurrentPosition(function(position) {
updateMap(position.latitude, position.longitude);
});
// Watch the position over time.
var watchId = geo.watchPosition(function(position) {
updateMap(position.latitude, position.longitude, position.accuracy);
});
geo.clearWatch(watchId);
// Only get the position if the last known position is more than a minute old.
var now = new Date().getTime();
var threshold = now - 60000;
if (geo.lastPosition &&
geo.lastPosition.timestamp.getTime()> threshold) {
updateMap2(geo.lastPosition);
} else {
loc.getCurrentPosition(function(position) {
updateMap2(position);
});
}
Aza 예제var geo = google.gears.factory.create('beta.geolocation');
// Get the position.
geo.getCurrentPosition(function(position) {
updateMap(position.latitude, position.longitude);
});
// Watch the position over time.
var watchId = geo.watchPosition(function(position) {
updateMap(position.latitude, position.longitude, position.accuracy);
});
geo.clearWatch(watchId);
// Only get the position if the last known position is more than a minute old.
var now = new Date().getTime();
var threshold = now - 60000;
if (geo.lastPosition &&
geo.lastPosition.timestamp.getTime()> threshold) {
updateMap2(geo.lastPosition);
} else {
loc.getCurrentPosition(function(position) {
updateMap2(position);
});
}
[code:js]
var geolocator = new navigator.GeolocationRequest();
geolocator.request(function(location) {
alert( location.latitude + ', '+ location.longitude + ", " + location.accuracy );
});
var geolocator = new navigator.GeolocationRequest();
geolocator.request({
success: function(location) { /* We've got the location! */ },
error: function(err){ /* There was an error getting location. */ },
accuracy: "neighborhood"
});
개인정보보호나 정확성에 관한 토의도 많습니다. Apple도 자신들만의 위치 관리자를 가지고 있다고 하는군요. var geolocator = new navigator.GeolocationRequest();
geolocator.request(function(location) {
alert( location.latitude + ', '+ location.longitude + ", " + location.accuracy );
});
var geolocator = new navigator.GeolocationRequest();
geolocator.request({
success: function(location) { /* We've got the location! */ },
error: function(err){ /* There was an error getting location. */ },
accuracy: "neighborhood"
});
이들 중 어느 하나로 통합이 되어, 브라우저에서 지리좌표 API를 사용할 수 있었으면 좋겠습니다. 한 개의 단순한 추상 객체가 수많은 훌륭한 응용프로그램으로 되는 법이죠.
from Location APIs: The Discussion on Ajaxian
'[IT] Ajaxian' 카테고리의 다른 글
| Processing.js: JavaScript와 Canvas로 Processing 언어를 구현하다! (0) | 2008/05/16 |
|---|---|
| Ajax 개척자 주간 : Dojo의 Alex Russell (0) | 2008/05/16 |
| Windows용 Growl과 Web Notification API (0) | 2008/05/16 |
| mountpoint://를 통한 File API (0) | 2008/05/15 |
| 구글의 Location API (0) | 2008/05/15 |
| Wii Darts: Wii 컨트롤러를 이용한 Ajax 응용프로그램 (1) | 2008/05/15 |
| Ajax 개척자 주간 : jQuery의 John Resig (0) | 2008/05/14 |
| 겸손한 Script를 통한 게으른 로딩 기능 (1) | 2008/05/14 |
| line-height : 고통? (1) | 2008/05/13 |
