Geonames get places close by - geonames

i was wondering how use the Geonames web service to return all places close to a certain lat long combination. The example of what i would like to do is here. See all the towns listed at the bottom in the table

On that page:
http://www.geonames.org/export/ws-overview.html
You find all web services available.
Service No.9 findNearby is a good candidate for your task.
In that "findNearby" Service you pass in:
Parameters : lat,lng, featureClass,featureCode, radius: radius in km (optional), maxRows : max
For featureClass and Code you have to read a bit the docu.

Related

Google geocoding API Inner Workings

I'm currently working with some large datasets that include some location based information but lack direct latitude and longitude measurements which I need in order to create visualizations.
In order to resolve this problem, I've been using geocoding APIs that require addresses or address-like information as input and provide latitude and longitude information as output.
I started by using the Nominatim API. Unfortunately, due to the nature of the address-like data that I have, many of my queries failed so I started using the Google geocoding API. The Google API provided me with a significantly higher success rate, but it is a paid API which is not ideal.
I realize that given the incredible resources that Google has that it would be virtually impossible to build a system that rivals their geocoding API within a reasonable amount of time, but it's made me wonder what's going on under the hood.
Is a BERT-like translational system at work? What happens to the text after it's sent off?
I'm using n-grams for similar usage by creating an index and an inverted index. See this package ngram
import ngram
...
country = filename.replace('.csv', '')
ind[country] = ngram.NGram()
inv[country] = {}
s_csv = csv.reader(stream, delimiter=';')
next(s_csv)
for row in s_csv:
coord = tuple(map(float, row[0:2]))
ad = ' '.join(row[2:]).lower()
ind[country].add(ad)
inv[country][ad] = (coord, address)
then you can use the find function
Take care of the memory consumption ~16GB RAM for a country like France and OSM Data
To see an implementation of that, check this OpenGeoCode HTTP API Service source code

The Here API returns distance, what unit of measurement is the numeric in?

here API... "distance"... is it meters? Is it miles? Feet?
Using the API here.com I am able to get lots of great info, one item is the distance somewhere is from the supplied location in their search api. The documentation shows the distance as a text example output, but I can't find anywhere that explains what the unit of measurement is. Maybe all sites use meters and this is just a dumb question? Maybe I am just not that good at searching through the documentation and it wasn't as hard to find as it seems? Maybe you have worked with the Here API and just know the answer?
Any help would be appreciated!
-dan
As mentioned in their documents, they use meters
information about each route segment (interconnection) in between two consecutive waypoints including the distance between them in meters and the estimated time in seconds
check it out here press ( cmd + F for mac or ctrl + F for windows ) and paste the above sentence you should be able to see it.
UPDATE: Check also here they mention its meters
It is meters. Please use our documentation page to get information on all the request and response fields for any API - developer.here.com/documentation/versions

Moving to OpenLayers from Google maps

I'm looking for some help on comparative OpenLayer functions for the following Google maps functions, can someone please let me know what these would be?
I'm currently using
For getting distance, using the distance matrix API:
http://maps.googleapis.com/maps/api/distancematrix
For getting latitude and longitude of the current address:
http://maps.googleapis.com/maps/api/geocode/json?address
Kindly check the attachment which are using for getting latitude, longitude and distance matrix.
Function names:
function getLatLng($add)
function getRoadDistance($from, $to)
--
things are a little bit more complicated in OL than they are with the google-api
Routing: if you have a small road network you can consider creating a Database in PostGIS and use pgrouting to get routing functions, you can find more on it here
Or if you want to use it on a bigger scale there some APIs that do it for you, for example yourNavigator, you'll have to make a get request with your coordinates like this
http://www.yournavigation.org/api/1.0/gosmore.php?format=geojson&flat=startLatitude&flon=startLongitude&tlat=destLatitude&tlon=destinationLongitude
there is also the OSRM for the same purpose.
to get the longitude and latitude based on an address you can use the geocoder for Openlayers 3
that's what I could think of right now, I hope it helps

Form Google Maps URL that searches for a specific places near specific coordinates

I have the longitude and latitude and the name of the place I want to look for. How do I edit the Google Maps URL so that I obtain all the places (name of the places) near a set of coordinates?
I know I could do this using Google Map API, but just for a link seems a lot of trouble.
You can use the query parameter ll for your lat and long, and you can use the query parameter q for what you want to search.
http://maps.google.com/?ll=39.774769,-74.86084
Or you can
http://maps.google.com/?q=your+query
Yeah, I had the same question for a long time and I found the perfect one. Here are some parameters from it.
https://maps.google.com/?parameter=value
q=
Used to specify the search query in Google maps search.
eg :
https://maps.google.com/?q=newyork or
https://maps.google.com/?q=51.03841,-114.01679
near=
Used to specify the location instead of putting it into q. Also has
the added effect of allowing you to increase the AddressDetails
Accuracy value by being more precise. Mostly only useful if q is a
business or suchlike.
z=
Zoom level. Can be set 19 normally, but in certain cases can go up to 23.
ll=
Latitude and longitude of the map centre point. Must be in that order. Requires decimal format. Interestingly, you can use this without q, in which case it doesn’t show a marker.
sll=
Similar to ll, only this sets the lat/long of the centre point for a business search. Requires the same input criteria as ll.
t=
Sets the kind of map shown. Can be set to:
m – normal map
k – satellite
h – hybrid
p – terrain
saddr=
Sets the starting point for directions searches. You can also add text into this in brackets to bold it in the directions sidebar.
daddr=
Sets the end point for directions searches, and again will bold any text added in brackets.You can also add "+to:" which will set via points. These can be added multiple times.
via=
Allows you to insert via points in directions. Must be in CSV format. For example, via=1,5 addresses 1 and 5 will be via points without entries in the sidebar. The start point (which is set as 0), and 2, 3 and 4 will all show full addresses.
doflg=
Changes the units used to measure distance (will default to the standard unit in country of origin). Change to ptk for metric or ptm for imperial.
msa=
Does stuff with My Maps. Set to 0 show defined My Maps, b to turn the My Maps sidebar on, 1 to show the My Maps tab on its own, or 2 to go to the new My Map creator form.
reference : http://moz.com/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
additional info:
http://maps.google.com/maps?q=loc:
put in latitude and longitude after, example:
http://maps.google.com/maps?q=loc:51.03841,-114.01679
this will show pointer on map, but will suppress geocoding of the address, best for a location without an address, or for a location where google maps shows the incorrect address.
As of Jan 2018 (update: still works in May 2022) the latest URL is:
https://google.com/maps/search/*your search string* (address, landmark, city, etc. Spaces are ok)
Examples:
https://google.com/maps/search/empire state building
https://google.com/maps/search/1600 Pennsylvania Ave NW, Washington, DC 20500
You can use the new URL for Google Maps: https://www.google.com/maps/#39.774769,-74.86084,18z
equivalent to http://maps.google.com/?ll=39.774769,-74.86084.
39.774769 is the latitude and -74.86084 is longitude and 18z is 18 zoom level.
Google now has a documentation page dedicated to Maps URLs:
https://developers.google.com/maps/documentation/urls/guide
An API key is not required.
Manipulating one of the examples, I came up with this URL scheme that fits your question:
https://www.google.com/maps/search/<search term>/#<coordinates>,<zoom level>z
A valid example of this would be:
https://www.google.com/maps/search/pizza/#41.089988,-81.542901,12z
This should show you all of the pizza places around Akron, Ohio.

Telephone Number to Geolocation UK

Is there a service that provides latitude and longitude for UK phone numbers?
For example:
Query: 0141 574 xxx, Returns: (55.8659829, -4.2602205) [Glasgow City Centre]
Allow me to stress that I am not looking for a reverse-directory-enquires. I am more interested in 'local area' for things like weather by phone or "Where's my nearest Pizza Shop?"
If this service doesn't exist your suggestions on how to implement it or where to get data from would also be incredibly useful.
I am aware that Ofcom provides a list of area codes with a place name [1] suitable for geolocation, but I have my concerns about resolution. I see this as a particular problem in smaller towns and rural areas where an area code will cover a large geographical area.
Second Example:
Area Code: 01555, Ofcom: Lanark
However:
01555 860xxx is Crossford (4 miles W of Lanark)
01555 77xxxx is Carluke (5 miles NW)
01555 89xxxx is Lesmahagow (5 miles SW)
01555 840xxx is Carnwath (7 miles NE)
Therefore 01555 covers about ~80 sq miles. That's not particularly local.
[1] Ofcom Area Code Tool: http://www.ofcom.org.uk/consumer/2009/09/telephone-area-codes-tool/
You can get a resonable location for numbers allocated to BT.
The "L" digits map to a particular exchange within that area:
(02X) LLLL XXXX (2+8)
(011X) LLL XXXX (3+7)
(01X1) LLL XXXX (3+7)
(01XXX) LLXXXX (4+6)
(01XXX) LLXXX (4+5)
(01XXXX) LXXXX (5+5)
(01XXXX) LXXX (5+4)
For cable providers (especially those using fibre optic delivery), there is sometimes only one exchange per area code and therefore the numbers in each LL range cover the entire area code.
For numbers allocoted to other providers there's a similar problem. Additionally, those numbers may be allocated as VoIP and in use in another area or even in a completely different country. For non-BT numbers location data cannot be relied on.
For people who have moved and kept their number, location data will also be inaccurate.
That said, CodeLook does a reasonable job of showing the right data: http://www.telecom-tariffs.co.uk/codelook.htm
You may have a problem in that not all numerics after area codes are geographic. Some have been block allocated to Cable Providers. I know my own number has belonged to myself and also a person who lived about 5 miles northeast of my current location, the link... we belong to the same cable provider.
What sort of telephone numbers are they? If they are businesses, what do you think of the possibility of searching for the whole number using say, Googles API, and lifting the actual address from the page? - I know thats harder to do than that, just exploring some possibilities ..;-

Resources