src="http://www.geosenseforwindows.com/images/logo.png" />
I love
applications that fill in where hardware fails, but this one is really taking the cake! href="http://www.geosenseforwindows.com/">Geosense for Windows gives you the
capabilities of a GPS sensor in your computer (but without the actual hardware!) It uses Google
Location Services to triangulate your location and provide your coordinates to applications that request
them.
Unfortunately, not many applications use this type of data (yet) but href="http://www.istartedsomething.com/20100301/geosense-for-windows-location-released/">Long Zheng
and href="http://www.withinwindows.com/2010/03/01/geosense-the-first-really-really-cool-windows-sensor/">Rafael
Rivera are hoping that with this new default driver for PCs without GPS, that many more developers
will embrace the creation of geo-location in desktop applications.
Continue Reading for
Code Snippets
To that effect, I’ve included some Code Snippets that
were originally posted on href="http://www.theleagueofpaul.com/blog/2010/03/01/geosense-for-windows-for-devs/">The League of Paul:
[codesyntax lang="cpp"]using
Windows7.Location;
public class Location
{
public String City {
get; set; }
public String Country { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
}
public static class GlobalPosition
{
private static LatLongLocationProvider _provider;
private static CivicAddressLocationProvider
_civicprovider;
private static bool _loadproviderthrowsexception = false;
private
const uint DEFAULT_REPORT_INTERVAL = 0;
public static Location GetLocation()
{
Location l = new Location();
try
{
if
(_loadproviderthrowsexception)
{
return null;
}
if
(_provider == null)
{
_provider = new
LatLongLocationProvider(DEFAULT_REPORT_INTERVAL);
_civicprovider = new
CivicAddressLocationProvider(DEFAULT_REPORT_INTERVAL);
}
var y =
_civicprovider.GetReport() as CivicAddressLocationReport;
l.City = y.City;
l.Country = y.CountryOrRegion;
var x = _provider.GetReport() as LatLongLocationReport;
l.Latitude = x.Latitude;
l.Longitude = x.Longitude;
return l;
}
catch (Exception ex)
{
return null;
}
}
}[/codesyntax]
and
Powershell:
[codesyntax lang="powershell"][Reflection.Assembly]::LoadFile("dll to location>\Windows7.SensorAndLocation.dll")
$provider = new-object
Windows7.Location.LatLongLocationProvider(0)
$position = $provider.GetReport()
$position.Latitude
$position.Longitude[/codesyntax]
It definitely makes you more aware of your surroundings, and that's a good thing because it means you can appreciate everything around you more.
ReplyDelete