how to show my location

6 views
Skip to first unread message

sithlord

unread,
Nov 6, 2009, 10:21:42 PM11/6/09
to Loki API
i wan t to display my position, where i am in my web page.. is it
possible to do so using my mac address or any other possible way..

martin.storbeck

unread,
Dec 9, 2009, 5:23:39 AM12/9/09
to Loki API
Hi!

I set this up on my website (http://www.storbeck.me / in german, sorry
for that): On the bottom-right you can see "Ich bin zu Hause" (which
means "I am home") and if you click on it you'll see the map from
http://mapme.at

It also updates my contact-info (phone / adress) and changes the icons
to grey, when I'm not home for example. You can see it in this
animation I made: http://storbeck.me/bilder/nachtschicht/status-updates.gif

I do that running Instamapper or Google Latitude on my iPhone at the
moment. Both share their information with mapme.at where I grab the
information via RSS and turn it into CSS using this little script:
http://files.storbeck.me/layout/mloc.php (since blogger doesn't
support PHP I had to do it that way...)

It returns RSS, the code is:

<?php
header('Content-Type: text/css; charset=ISO-8859-1');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "mapme.at/api/where.json?
mode=day&username=hdready");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$json = curl_exec($ch);
curl_close($ch);
$data = json_decode($json);
$location = strtolower($data->locations[0]->local_area);

if (strstr($location, "gräfinau-angstedt")) {
?>

.phone {background: url(http://storbeck.me/layout/contact_phone.gif)
no-repeat;}
.address {background: url(http://storbeck.me/layout/contact_home.gif)
no-repeat;}
.homezone {visibility:hidden; position: absolute;}
.loc_ga {position: relative;}
.loc_ik, .loc_hm, .loc_bs, .loc_else {visibility:hidden; position:
absolute;}

<?php
} elseif (strstr($location, "ilmenau")) {
?>

.phone {background: url(http://storbeck.me/layout/
contact_homezone.gif) no-repeat;}
.address {background: url(http://storbeck.me/layout/
contact_home_offline.gif) no-repeat;}
.homephone {visibility:hidden; position: absolute;}
.homezone {position: relative;}
.loc_ik {position: relative;}
.loc_bs, .loc_hm, .loc_ga, .loc_else {visibility:hidden; position:
absolute;}

<?php
} elseif (strstr($location, "braunschweig")) {
?>

.phone {background: url(http://storbeck.me/layout/
contact_phone_offline.gif) no-repeat;}
.address {background: url(http://storbeck.me/layout/
contact_home_offline.gif) no-repeat;}
.homezone {visibility:hidden; position: absolute;}
.loc_bs {position: relative;}
.loc_ik, .loc_hm, .loc_ga, .loc_else {visibility:hidden; position:
absolute;}

<?php
} elseif (strstr($location, "holtensen")) {
?>

.phone {background: url(http://storbeck.me/layout/
contact_phone_offline.gif) no-repeat;}
.address {background: url(http://storbeck.me/layout/
contact_home_offline.gif) no-repeat;}
.homezone {visibility:hidden; position: absolute;}
.loc_hm {position: relative;}
.loc_ik, .loc_ga, .loc_bs, .loc_else {visibility:hidden; position:
absolute;}

<?php
} elseif (strstr($location, "hameln")) {
?>

.phone {background: url(http://storbeck.me/layout/
contact_phone_offline.gif) no-repeat;}
.address {background: url(http://storbeck.me/layout/
contact_home_offline.gif) no-repeat;}
.homezone {visibility:hidden; position: absolute;}
.loc_hm {position: relative;}
.loc_ik, .loc_ga, .loc_bs, .loc_else {visibility:hidden; position:
absolute;}

<?php
} else{
?>

.phone {background: url(http://storbeck.me/layout/
contact_phone_offline.gif) no-repeat;}
.address {background: url(http://storbeck.me/layout/
contact_home_offline.gif) no-repeat;}
.homezone {visibility:hidden; position: absolute;}
.loc_else {position: relative;}
.loc_ik, .loc_hm, .loc_ga, .loc_bs {visibility:hidden; position:
absolute;}

<?php
}
?>

Hope that helps,

Martin
Reply all
Reply to author
Forward
0 new messages