Map search results show in a table - ios

I am working on a school project and I can't figure out how to have someone search for a location and then have the results show in a table view.
Ive searched everywhere for some way to do this but found nothing.

There are (with the Apple's API, at least) two types of searches:
CLGeocoder lets you search for an address, or do a reverse search on the basis of the coordinates (e.g. to get the address of the selected coordinates). For example:
If you want to search for an address within a region use geocodeAddressString(_:in:completionHandler:) (passing it the map's region);
If you want to search the world for a given address string, use geocodeAddressString(_:completionHandler:);
If you want to perform reverse geocode lookup of a particular coordinate, use reverseGeocodeLocation(_:completionHandler:).
MKLocalSearch lets you search within a particular MKRegion (e.g. the visible portion of the current map) for points of interest. To do that, you:
Create a MKLocalSearch.Request, setting its region (presumably to your map’s region) and naturalLanguageQuery; and
And then instantiate a MKLocalSearch and then start the search with start(completionHandler:).
If your goal is to show completions for an address as a user types it, you can use MKLocalSearchCompleter.
I assume you're looking for the MKLocalSearch, but these are the basic kinds of searches you can do.

Related

Get random address/coordinates in a specified town

Is there any way to give Google Maps API or a similar API a town name and have it return a random address inside the town? I was hoping to be able to get the data as a JSON so I could parse it with SwiftyJSON in XCode and use it, but I can't seem to find any way to get the address in the first place. If coordinates would be easier to get, then those would work too, as long as its random and inside the town borders.
You can try to use Google Places API Web Service. It allows you to query for place information on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more. You can search for places either by proximity or a text string. A Place Search returns a list of places along with summary information about each place.
A Nearby Search lets you search for places within a specified area. You can refine your search request by supplying keywords or specifying the type of place you are searching for.
A Nearby Search request is an HTTP URL of the following form:
https://maps.googleapis.com/maps/api/place/nearbysearch/output?parameters
where output may be either xml or JSON values.
And if you want either address or coordinates, you can use Geocoding for it. Here i found a tutorial on how to use Geocoding in IOS.

Is it possible to create a choropleth map solely from a set of long/lat coordinates?

I'd like to visualize a number of points on a map. Unfortunately, there is no consistent address associated with each one. I've used Google Fusion tables to get a rough read on where the points are, and am relatively satisfied with the approximate locations of most points (sometimes Google figures out where they're located based on a landmark, sometimes based on an intersection provided, sometimes by street address, etc.).
My goal, then, is to create a choropleth map of a city (NYC, in this case), showing the number of points located in each neighbourhood. Is it possible to do this by somehow counting the number of points that fall within each neighbourhood?
I suspect that if fusion tables give me a passable visual, I may be able to use google's geocoding service in the same manner to figure out the number of points in each area, and use this to then build a choropleth (not a heat map — I'm after some level of interaction, like tooltips over each neighbourhood).
Is there any way to do this, or am I way, way off?

search lat/log from Adress using GMMap in Delphi

I wanted just and simply hit a normal full address in edit box and get it's position (lat/log) and mark it in the map. I don't have any clue about getting latitude and longitude from adress , I was searching in GMMap properties , I could not see it at all. Could you please a help on that ?
Thanks
To obtain a lat/lng from an address, you need to geocode it. To do that, put a TGMGeocode component, link it with the TGMMap and call Geocode method with the address.
A geocodification can return 1 or more results (until 10 with standard Google access). For example, if you geocode "Andorra" you will get 2 results, Andorra a country and Andorra a city from Spain. For this reason, the result of geocodification is an array (GeoResult). You can iterate it with Count property.
To know the lat/lng from a GeoResult, you need to read TGMGeocode[i].Geometry.Location property or TGMGeocode.GeoResult[i].Geometry.Location property (is the same)

Twitter Stream api filter by location AND track

I'm using the following line in order to get geolocated tweets that contain a certain keyword. (I'm using the word Madonna)
https://stream.twitter.com/1.1/statuses/filter.json?track=Madonna&locations=-180,-90,180,90
My problem is that result is not consisted by geolocated tweets that contain the keyword Madonna, but is consisted by geolocated tweets in general.
Any help on what I'm doing wrong here?
"-180,-90,180,90" - it is worldwide location;
Currently for use "AND" instead of "OR" in Twitter stream API you need make request like this: https://stream.twitter.com/1.1/statuses/filter.json?locations=-74,40,-73,41 and filtered results by "Madonna" inside your app after. Unfortunatly, I can not find another way for today;
Filtering by locations can contain:
If coordinates is empty but place is populated, the region defined in
place is checked for intersection against the locations bounding box.
Any overlap will match.
Another, somewhat hack-y solution to this, is you can have a track key work that would never match, such as "dkghaskldfnascjkawenaf", and add a location bounding box.
The API does an OR relationship between tracking and location, you'll only receive tweets from within (or very nearby) the bounding box

City By GPS Location Latitude/Longitude

I've got a latitude/longitude value.... How can I search and get the city?
If you're looking for free (as freedom) sources, you can use Geonames API findNearbyPlaceName.
For example the following returns nearest Placename:
http://api.geonames.org/findNearbyPlaceName?lat=47.3&lng=9&username=demo
More information is available here
http://www.geonames.org/export/web-services.html#findNearbyPlaceName
Another option is getting data from Freebase. Instead of single point it takes bounded box:
http://api.freebase.com/api/service/geosearch?location=[30.2,50.4,30.6,50.8]&location_type=/location/citytown&inside=true&indent=1
Using the google maps api, here is an example to get the address in XML format.
http://maps.google.com/maps/api/geocode/xml?latlng={latlng}&sensor={sensor}&region={region}
Where latlng = 0,0 sensor = false, and region = country code, so for my old address it would be
http://maps.google.com/maps/api/geocode/xml?latlng=-43.893792,171.7592620&sensor=false&region=nz
Then you can use that XML to get whatever details you need, including the City

Resources