In the UK, how do I find an address given the GPS coordinates? - mapping

Sorry this is not a very well defined question, I am thinking about an idea for a product, so need to know what is possible...
Say I am standing at the fount door of a house, given the GSP coordinates from a smart phone, how can I find the address I am standing at?
Is GPS good enough for this?
How much does the data/service I need to use cost?
What other questions should I be asking about this?

GPS is limited to returning the latitude and longitude coordinates of your position.
To resolve these coordinates to an address, you would need to use an external data source. The act of converting a geographical coordinate to an address is often referred to as reverse geocoding.
There are some free reverse geocoding services such as that offered within the Google Maps API. However make sure you read and understand the Terms of Use before using such a service.
As an example, you can do reverse geocoding with the Google Maps API using the following HTTP request:
Simple CSV:
http://maps.google.com/maps/geo?q=40.756041,-73.986939&output=csv&sensor=false
Returns:
200,8,"601-699 7th Ave, New York, NY 10036, USA"
More Complex XML:
http://maps.google.com/maps/geo?q=40.756041,-73.986939&output=xml&sensor=false
Returns:
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
<name>40.756041,-73.986939</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>601-699 7th Ave, New York, NY 10036, USA</address>
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><SubAdministrativeArea><SubAdministrativeAreaName>New York</SubAdministrativeAreaName><Locality><LocalityName>New York</LocalityName><DependentLocality><DependentLocalityName>Manhattan</DependentLocalityName><Thoroughfare><ThoroughfareName>601-699 7th Ave</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>10036</PostalCodeNumber></PostalCode></DependentLocality></Locality></SubAdministrativeArea></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7595131" south="40.7532178" east="-73.9835667" west="-73.9898620" />
</ExtendedData>
<Point><coordinates>-73.9869192,40.7560331,0</coordinates></Point>
</Placemark>
<Placemark id="p2">
<address>Times Sq - 42nd St Station, New York, NY 10116, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>Times Sq - 42nd St Station</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7591946" south="40.7528994" east="-73.9838014" west="-73.9900966" />
</ExtendedData>
<Point><coordinates>-73.9869490,40.7560470,0</coordinates></Point>
</Placemark>
<Placemark id="p3">
<address>Times Square - 42nd Street</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>Times Square - 42nd Street</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7591476" south="40.7528524" east="-73.9838524" west="-73.9901476" />
</ExtendedData>
<Point><coordinates>-73.9870000,40.7560000,0</coordinates></Point>
</Placemark>
<Placemark id="p4">
<address>W 42 St - 7 Av, New York, NY 10116, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>W 42 St - 7 Av</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7591446" south="40.7528494" east="-73.9839964" west="-73.9902916" />
</ExtendedData>
<Point><coordinates>-73.9871440,40.7559970,0</coordinates></Point>
</Placemark>
<Placemark id="p5">
<address>New Amsterdam Theatre, New York, NY 10036, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><Locality><LocalityName>New York</LocalityName><PostalCode><PostalCodeNumber>10036</PostalCodeNumber></PostalCode><AddressLine>New Amsterdam Theatre</AddressLine></Locality></AdministrativeArea></Country></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7593416" south="40.7530464" east="-73.9842484" west="-73.9905436" />
</ExtendedData>
<Point><coordinates>-73.9873960,40.7561940,0</coordinates></Point>
</Placemark>
<Placemark id="p6">
<address>W 42 St - 7 Av, New York, NY 10116, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>W 42 St - 7 Av</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7594606" south="40.7531654" east="-73.9842484" west="-73.9905436" />
</ExtendedData>
<Point><coordinates>-73.9873960,40.7563130,0</coordinates></Point>
</Placemark>
<Placemark id="p7">
<address>Times Sq - 42nd St Station, New York, NY 10116, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>Times Sq - 42nd St Station</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7589406" south="40.7526454" east="-73.9832194" west="-73.9895146" />
</ExtendedData>
<Point><coordinates>-73.9863670,40.7557930,0</coordinates></Point>
</Placemark>
<Placemark id="p8">
<address>W 42 St - Broadway, New York, NY 10116, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>W 42 St - Broadway</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7588236" south="40.7525284" east="-73.9831654" west="-73.9894606" />
</ExtendedData>
<Point><coordinates>-73.9863130,40.7556760,0</coordinates></Point>
</Placemark>
<Placemark id="p9">
<address>7 Av - W 41 St, New York, NY 10116, USA</address>
<AddressDetails Accuracy="9" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><AddressLine>7 Av - W 41 St</AddressLine></AddressDetails>
<ExtendedData>
<LatLonBox north="40.7586296" south="40.7523344" east="-73.9843024" west="-73.9905976" />
</ExtendedData>
<Point><coordinates>-73.9874500,40.7554820,0</coordinates></Point>
</Placemark>
</Response></kml>
Simply change the q parameter with your latitude,longitude.
Note that the free version of the Google Maps API has a limit of 15,000 request per IP address per day. (Google Maps API FAQ)
If you are planning to heavily use Google's reverse geocoding services, you may want to consider using the Premier edition of the Google Maps API.
The Premier API automatically comes with "advanced geocoding capabilities with greater volume and speed", so the limitations of the standard API should be superseded by new quotas.
As an additional side-note, according to one unofficial source (dated April 2008), the cost for the Premier API starts at USD 10,000 per year.

You can use various free services, such as those provided by Google to reverse-geocode (the technical term) an address from some GPS coordinates. I strongly suggest having a play with their API, full documentation is available here:
http://code.google.com/apis/maps/documentation/services.html

Google's Geolocation Network Protocol might help; I think it worked for UK locations when I last tried it.

Btw, the Ordinance Survey just released their data under really loose licensing and I think they have a web service as well. You might want to give that a look.

OpenStreetMap (the free open-source map of the world created by volunteers) uses Nominatim, which seems to be very good. See
http://wiki.openstreetmap.org/wiki/Nominatim#Reverse_Geocoding_.2F_Address_lookup

Related

Rails Form Field for Selecting a State

I'm creating a Payment Form where users have to enter their state
In my users model, I have a state attribute
I have a states array as follows
states = %w(AL AK AZ AR CA CO CT DC DE FL GA HI ID IL IN IA KS KY LA ME MA MI MN MO MS
MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY)
I want to create a drop-down menu where users can select a state
I read the documentation, but am confused on how to implement it.
Would something like this work?
<%= select_tag(:state, options_for_select(states)) %>
The output should look like this
AL
AK
...
WY
And you can select each of the options.
While I am not always a fan of just grabbing and installing gems, I have found the Better State Select gem to be handy in these scenarios. Mostly because I can't be bothered to keep arrays of states in multiple apps :)!
Better State Select
I ran your code just fine in one of my apps so I can't see an issue with what you have but wanted to offer the Better State Select gem suggestion simply because I've found it an easier way to manage things like states (and as we expand into Canadia, it already has their provinces, etc.).
Anyway, your code seems fine/workable to me as is!

Get Geospatial Geometry Coords for City & State or Zipcode

Does anyone know if there is somewhere on the internet that i can enter City & State or Zipcode so that i can get the Spatial Geometry Coords for that city and state.
Reason i need this is that i get several files that are imported to our site with City Names abbreviated. So i will have to make the abbreviated citys in the database manually but give the right coord information to our maps and distance calculations.
Here is an example of our database... Below it is Examples of city names that are abreviated.
ID CORDS CITY STATE ZIP CREATED UPDATED CS
69629;"0101000020E61000004A24D1CB28A055C097FDBAD39DCD4040";"moody";"al";"35004";"2012-05-31 11:00:34.133281";"2012-05-31 11:00:34.133281";"moody, al"
69630;"0101000020E610000016139B8F6BBD55C0D28C45D3D9CB4040";"adamsville";"al";"35005";"2012-05-31 11:00:34.187562";"2012-05-31 11:00:34.187562";"adamsville, al"
69631;"0101000020E610000093C6681D55CF55C09B92ACC3D1B94040";"adger";"al";"35006";"2012-05-31 11:00:34.1948";"2012-05-31 11:00:34.1948";"adger, al"
69632;"0101000020E6100000AF7C96E7C1B355C07A6F0C01C09D4040";"alabaster";"al";"35007";"2012-05-31 11:00:34.203153";"2012-05-31 11:00:34.203153";"alabaster, al"
69633;"0101000020E6100000EFE192E34E7B55C07714E7A8A3734040";"alexander city";"al";"35010";"2012-05-31 11:00:34.211388";"2012-05-31 11:00:34.211388";"alexander city, al"
69634;"0101000020E6100000E09C11A5BD9155C09357E71890AD4040";"alpine";"al";"35014";"2012-05-31 11:00:34.219605";"2012-05-31 11:00:34.219605";"alpine, al"
69635;"0101000020E6100000DD0720B5899F55C0C11C3D7E6F294140";"arab";"al";"35016";"2012-05-31 11:00:34.228182";"2012-05-31 11:00:34.228182";"arab, al"
69636;"0101000020E6100000CA54C1A8A4A855C0CC6262F371254140";"baileyton";"al";"35019";"2012-05-31 11:00:34.23646";"2012-05-31 11:00:34.23646";"baileyton, al"
69637;"0101000020E610000097C5C4E6E3BC55C09ACC785BE9B34040";"bessemer";"al";"35020";"2012-05-31 11:00:34.244822";"2012-05-31 11:00:34.244822";"bessemer, al"
Examples of what was searched that didnt show up in our database
"FT SASKATCHEWN, AB"
"Gulfport, MD"
"La Costa Apts, CA"
"Mccarley, NV"
"W Union, SC"
"SUNNY ISLES BEACH, FL"
"Middleton Nh, NH"
"ST ANTONIN, QC"
"ft leonard wood, MO"
"Russellville, OK"
"Pleasant Prairie, PA"
"Chickalah, AR"
"MONTGOMERY COUNTY AREA, PA"
"VERSA COLD, GA"
"Rock Glen, SK"
"Pine Groven Holland, PA"
"Bethelneffs, PA"
"La Folette, TN"
"TRACY, CH"
"Magnolia, MA"
"MONT LAURIER, QC"
"CHATEAUGAY, QC"
"Puebla, MX"
"LaFollette, TN"
"ft hunter ligget, CA"
"ST GENEVIEVE, MO"

How to make the iCal in iPad to convert the received events in the proper time according the time zone of the device

I am using DDay.iCal library to create an event with that should be in exact timezone:
BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:someId
BEGIN:VTIMEZONE
TZID:Central Europe Standard Time
BEGIN:STANDARD
DTSTART:20111002T030000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYHOUR=3;BYMINUTE=0;BYMONTH=10
TZNAME:Central Europe Standard Time
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20110301T020000
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYHOUR=2;BYMINUTE=0;BYMONTH=3
TZNAME:Central Europe Daylight Time
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DESCRIPTION:Some Description
DTEND;TZID=Central Europe Standard Time:20120919T163000
DTSTAMP:20120913T082257Z
DTSTART;TZID=Central Europe Standard Time:20120919T160000
LOCATION:Some Location
SEQUENCE:0
SUMMARY:Some Summary
UID:1cf04d1c-2b5c-474c-86f4-108101da9b7a
END:VEVENT
END:VCALENDAR
As you can see the event is declared in Central European Standard Time for 16:00 - 16:30.
I am in another timezone - GMT + 2.
When I am adding the event to outlook in win7 - it is converted to my local time = from 17 to 17:30.
When I am adding it to a friend's Mac - it is converted to his local time.
When I am trying to add it in a Ipad which is set to the same timezone - GMT + 2, and with timezone support on, it is not converted but set to 16 - 16:30 and the timezone for the event is put to floating.
So my question is what I should change in the setup of the event to recognize it and converted to the right time?
Or maybe I should change something in the iPad settings.

GIS: How to read METAR & TAF values to get the pressure at sea level?

I have this link on how to get the altitude in Android -> SensorManager.getAltitude(pressure at sea level, atmospheric pressure)
But... need to know the value for PRESSURE AT SEA LEVEL. I have read the below statement from Android documentation on how to obtain it.
The pressure at sea level must be known, usually it can be retrieved
from airport databases in the vicinity.
Then, I found url that may give the values by providing the airport code. In my case, it's Tokyo International Airport (Haneda). The airport code is HND.
Here's the web service provider url:
http://avdata.geekpilot.net/
Here's the sample output for Tokyo International Airport (http://avdata.geekpilot.net/weather/HND)
<weather>
<ident>RJTT</ident>
<error/>
<metar>
2011/09/22 08:00
RJTT 220800Z 04019KT 9999 -SHRA FEW012 BKN025 BKN040 21/18 Q1000 NOSIG
</metar>
<taf>
2011/09/22 04:12
TAF
AMD TAF
AMD RJTT 220409Z 2204/2306 08016KT 9999 FEW030 SCT050
BECMG 2204/2206 05014KT
TEMPO 2207/2209 36018G30KT SHRA
BECMG 2303/2306 10008KT
</taf>
</weather>
Problem: don't know on how to read the above information to obtain the value.
METAR altimeter (sea level pressure) data are usually presented as A2992 or ALTSG 2992 where 29.92 is the value in in. Hg or at airports using millibars as Q1000 as in your example, which is exactly 1 atmosphere or bar.
I found url to translate obtain it and translate it to readable format.
find local sea level pressure
My airport code there is RJTT (Tokyo International Airport Haneda)
Here's the sample output (Pressure (altimeter): 30.21 inches Hg (1023.0 mb)):
METAR text: RJTT 260100Z 03011KT 9999 FEW025 BKN110 BKN170 20/14 Q1023 NOSIG RMK 1CU025 6AC110 7AC170 A3021
Conditions at: RJTT (TOKYO INTL AIRPO, JP) observed 0100 UTC 26 September 2011
Temperature: 20.0°C (68°F)
Dewpoint: 14.0°C (57°F) [RH = 68%]
Pressure (altimeter): 30.21 inches Hg (1023.0 mb)
Winds: from the NNE (30 degrees) at 13 MPH (11 knots; 5.7 m/s)
Visibility: 6 or more miles (10+ km)
Ceiling: 11000 feet AGL
Clouds: few clouds at 2500 feet AGL
broken clouds at 11000 feet AGL
broken clouds at 17000 feet AGL
Weather: no significant weather observed at this time

Why does Google's Geolocation API think that I'm always in Monterey, CA?

After asking for and getting a fancy little program that allows me to turn any 802.11 Ethernet MAC address into a Geolocation using Google's Geolocation API, I am distressed to find out that Google thinks I'm always in Monterey, CA when I use it from one computer, and in Newport Beach when I use it at another.
Here is a revised version of the program that I'm using:
<?php
$mac = $_SERVER['argv'][1];
$postData = '{
"version": "1.1.0",
"request_address":"true",
"wifi_towers": [{
"mac_address": "' . $mac . '"
}]
}';
$opts = array(
'http'=>array(
'method' => "POST",
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postData
)
);
$response = file_get_contents(
'http://www.google.com/loc/json',
false,
stream_context_create($opts)
);
$response = json_decode($response, true);
$loc = $response['location'];
$addr = $loc['address'];
echo "Geolocate $mac:\n";
echo $addr['street'],"\n";
echo $addr['city'],", ",$addr['region']," ",$addr['postal_code'],"\n";
echo "Lat/Lon: ",$loc['latitude'],",",$loc['longitude'],"\n";
And here are the results I'm getting:
% php geolocate.php 00:E0:6F:90:A1:71
Geolocate 00:E0:6F:90:A1:71:
W Franklin St
Monterey, California 93940
Lat/Lon: 36.600237,-121.894676
% php geolocate.php 00:D0:25:8A:79:14
Geolocate 00:D0:25:8A:79:14:
W Franklin St
Monterey, California 93940
Lat/Lon: 36.600237,-121.894676
% php geolocate.php 00-D0-25-8A-79-14
Geolocate 00-D0-25-8A-79-14:
W Franklin St
Monterey, California 93940
Lat/Lon: 36.600237,-121.894676
%
Here is on another machine:
$ php geolocate.php 00:D0:25:8A:79:14
Geolocate 00:D0:25:8A:79:14:
Via Lido
Newport Beach, California 92663
Lat/Lon: 33.61891,-117.928946
$ php geolocate.php 00:E0:6F:90:A1:71
Geolocate 00:E0:6F:90:A1:71:
Via Lido
Newport Beach, California 92663
Lat/Lon: 33.61891,-117.928946
It makes no sense that every ethernet address I try is on W Franklin Street in Monterey. Is it defaulting to something associated with my IP address?
This is wifi localization and it's far from accurate when not connected using wifi. Here you script give my location in the middle of Paris, France and the machine I used is located in the east of Paris and connected by dsl.
See http://www.google.com/support/mobile/bin/answer.py?hl=en&answer=81873
According to the question you're referring to, the Google geolocation API works by looking up the MAC address of the wireless access point, not your machine's MAC address. It sounds as if it's simply querying a database they've collected of AP MAC addresses and corresponding coordinates.

Resources