I'm using the Reverse Geocoding provided by Apple (Linked to the dev documentation at the bottom of this post).
I have set this up to work with my current project. When I touch the map, the touchPoint is converted to coordinates which I use with my reverse geocoding. The problem is though, that I only get information regarding address (street, housenumber, country and so on) when I geocode a location from Europe, North America and parts of South America. I do NOT get this information when doing a reverse geocoding on coordinates from Africa and Asia.
I used Forward Geocoding (some random addresses in Africa and Asia) to check if these could be found with all the information. And they could - the forward geocoding works brilliant.
So how can it be, that I don't get address information when I reverse the geocoding with coordinates from especially Africa and Asia? Anyone experienced the same thing?
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/UsingGeocoders/UsingGeocoders.html#//apple_ref/doc/uid/TP40009497-CH4-SW1)
Reverse GeoCoding (See error message returned kCLErrorGeocodeFoundPartialResult and kCLErrorGeocodeFoundNoResult). Many times only the US, Europe and densely populated cities of the world return full reverse address information.
When kCLErrorGeocodeFoundPartialResult occurs, that mean only a portion of the reverse geocode information is available. This may be the street name (individual addresses, meaning house/bdlg or lot#) is not available. This could be less and less information down to just the country name.
This is because for use with Google, the satellites only return lat & lon. It is up to Google or other mapping companies to provide data points and data point region information (meaning lat/lon and span around that point that a bldg would occupy for an address). Because this information has to be acquired from each and every single municipality around the world, then verified and data entered - it is a HUGE undertaking for which Google has been actively doing for over 10 years. In this time, there is less than 7% of the earth's land masses that is majority geocoded. Adding to this difficulty is that the US and the Majority of Europe are relatively well organized at the municipality level with up to date maps and parcel/lot locations. That same is not true for many other areas of the world.
So it is up to you, the developer, to sift through the available information and structure the annotation callout information that makes the most sense from the limited information returned. Again, this may just be the Country Name.
Also, don't forget about Ocean and InlandWater fields for if you user drops a pin in the great Lakes or the Hudson River.
the Name field is also helpful for Landmarks.
Yes, in the end, there is a lot of juggling to figure out how best to display place mark data returned from a reverse geocode lookup, but your users will thank you for trying out every possibility you can think of.
The above information as well as lists for full geocode and partial geocode countries is in the Apple Documentation. You would be surprised to see just how few countries there are on those lists!
Related
I am trying to show the current distribution of individuals across a world map, but I am running into trouble trying to standardize location data.
This is a simple feat with the locations of the American and Canadian individuals as they all follow a similar structure (City -> State -> Country). I would ideally like to show these on the city level so that each state with multiple individuals doesn't only contain one dot.
However, there are cities such as Kampala, Bicester, or Bucharest that do not have a state or province and the next largest region is the country itself.
If I use the city as the level of granularity, I see what I'm looking for in the US/Canada area but miss all of the geographical areas without a state. If I show only the State/Country, not only do I miss those without a state, but I also am only seeing one dot for each state whereas I want to see a dot for each city in the state that an individual resides in.
I tried to edit the unknown locations but was still unable to resolve the state/province conundrum. I am unsure how to get around this and can't find any resources discussing this issue. Can anyone point me in the right direction on how to standardize inconsistently formatted location data?
I used the overpass api to downloaded a couple of tiled pieces of USA's map and now that I have the USA map locally, I would like to obtain the bounds of a given city (or state) without involving the API.
Should I search for certain tags, or relations? I assume I'll have to start from a node tagged (k=name, v=city_name) and (k=place, v=city), and based on it's id to find a way node.
Is my assumption correct? If yes, can you give me some directions on what should I look for once I have the node corresponding to the city?
Note. I went through the OSM wiki and studied a little bit the OSM XML format, however I was not able so far to have a whole picture of the OSM XML structure, so perhaps someone who has more experience with this can help me.
Administrative boundaries are mapped as ways or relations with a boundary=administrative tag. The boundary type is specified by an admin_level. The admin_level value for cities differs from country to country and can even include multiple values. But for most countries, admin_level values for cities range from 6 to 8 (for the US it starts even from 5). In contrast, US states have an admin_level of 4. With the help of these keys you can construct a Overpass query for specific cities/stares, or even query for all cities and states. Here is an example for Denver:
[out:json][timeout:25];
// gather results
(
way["boundary"="administrative"]["admin_level"~"6|7|8"]["name"="Denver"];
relation["boundary"="administrative"]["admin_level"~"6|7|8"]["name"="Denver"];
);
// print results
out body;
>;
out skel qt;
You can see that it will yield multiple results. Look at the place and admin_level tags to determine the importance of your results.
Alternatively you can use a geocoder as for example Nominatim. Here is an example for Denver. In contrast to Overpass API, Nominatim will weight the results by importance. It also supports multiple output formats and can return polygons (which you can use for determining the bounds). Please read about Nominatim's usage policy when using the instance at nominatim.openstreetmap.org.
And also see search engine results.
In my location based iPhone app I like to let it also work with no network availability. I have a normal google map. The app works with forward geocoding so when a city or country is typed in, I need the longitude and latitude. Can this work on a offline basis and how?
You can find a database here:
http://dev.maxmind.com/geoip/geolite
Go for the CSV/Zip GeoLite City database. It has an archive of data going back to 2009. Make sure to download the latest one, at the bottom (GeoLiteCity_20130101.zip). You could also go for the gzip, or binary data version, but I don't know the exact format of the binary data. It's explained somewhere on the website.
The CSV archive has two CSV files. GeoLiteCity-Location.csv has a rather large database of cities (which you would probably want to convert into a format that would be able to be searched faster than an array, and hopefully take up less space). It contains the country, region (eg State), city, latitude and longitude for just under 400,000 cities across the globe. The other file contains IP ranges for those cities, if you also need that.
I have store various latitude and longitude in database(Sqlite3) for various location. Now I have current latitude and longitude. How can I know nearest locations from current position.
Please suggest.
I assume you're talking about Reverse Geocoding. There's an Apple class provided for that, MKReverseGeocoder. There are also plenty of how-to discussions about that, such as here, here, etc.
The syntax will likely need to change, but take a look at this question that uses MySQL. Essentially you want to create a rectangle with the current point at the center (most likely). Using the bounds of this new box, you can run your SQL query.
I dare say #Kongress answer is the best here - but I'm just going to chuck this one into the ring as the concept itself is one that I've dealt with before.
I can't tell you how to build one in objective-c, but for our lat/long reverse lookup I built a K-DTree from the lat longs in our database ( > 250,000) and it gives us sub-100-nanosecond lookups on desktop hardware. On an iphone it's still likely to be pretty fast - memory might be a concern though as you really need to be able to cache the instance in memory, to be really useful; it takes a little while to build it (ours builds in about 1.5 seconds).
Just an idea.
There are probably about 600 councils in Australia. I need to work out how to create boundaries for them all within my iPhone application so that when a user is in a certain area the application will know which council the user is in.
I probably can get a lot of this information from councils, however what information would I need to ask for? Is boundary information enough? And then how should my developer use that?
Thanks,
It sounds like what you're asking about is how to define the boundary of a council. Generally the boundary of a council (or country, or any other geographic region) can be defined by an ordered series of latitude, longitude pairs which represent points on the surface of the Earth; the border is the line that connects them.
Such a series might look a bit like the following:
Region 1:
64.222, 41.135
64.161, 41.143
64.114, 41.080
...
Region 2:
64.114, 41.080
64.008, 41.090
64.008, 40.902
...
Given such a series of border points there are established algorithms for determining whether a given point is within the region (if you're curious you can read about them here). I'm not sure whether there are more efficient algorithms for determining which of several regions a point is in, but that's for your developer to figure out.
I'll answer your two questions separately:
1. Where do I get council map boundaries for Australia?
The Australian Bureau of Statistics publish this data in ESRI Shapefile and MapInfo format. The areas are known as "Local Government Areas". The 2010 data set is available at http://www.abs.gov.au/AUSSTATS/abs#.nsf/DetailsPage/1259.0.30.001July%202010?OpenDocument
2. How do I use geospatial data?
The ESRI Shapefile format can be read by pretty much every spatial data package under the sun. I have some favourites however:
On client side my favourite library is GDAL, a translator library with an X/MIT style Open Source license. It comes with C, C++, Python and C# bindings. Or if this is too heavyweight, you might prefer to directly use Shapelib, an MIT licensed C library used by GDAL.
On the server side you can't go past PostGIS. If you are sending your latitude/longitude pair to a web server, consider installing these spatial extensions for the postgresql server. You can load a shapefile into the database using the bundled shp2pgsql utilty. Then, to find the LGA your lat/lon pair fall into query the database like this:
SELECT * FROM lga2010
WHERE ST_Intersects(lga2010.the_geom,
ST_SetSRID(ST_MakePoint(your_longitude, your_latitude),4326))