MapView look for Places - cocoa-touch

I have a UIMapView in my iPhone-app.
First I want to show streetnames on it.
Second I want to give the user the chance to look for places with an UISearchViewController.
Are there any tutorials for these 2 points and which service do you think is the best for finding places?

You need to explore and understand Apple's MapKit Framework (https://developer.apple.com/library/ios/documentation/MapKit/Reference/MapKit_Framework_Reference/_index.html). To show stuff on the Map you can use MKAnnotations and MKLocalSearch to get points of interest around the user's location. The Documentation is super clear and has examples on how to get latitude/longitude, drop pins, pin-point user's location, add balloons with info (MKAnnotations), etc. Also, take a look at UISearchViewController documentation to see if it is the best for your use case.
Then, I would suggest you to take a look at Google Places Search API (https://developers.google.com/places/documentation/search) or Foursquare's API (https://developer.foursquare.com/docs/). At the end everything is about showing the info coming on a JSON response from one of the APIs on a List or on the Map with balloons.
If your data source ends up being Google Places... I would suggest you to use Google Maps for iOS instead of the native MapKit.
As for tutorials, there are probably 100s of them in the Interwebz... but I suggest you to start with Apple Documentation on MapKit understand that first and then try to mix it with other data sources.
Good luck and happy holidays!

Related

How can I custom limit the extent of an ArcGIS basemap?

I am writing web application based on ArcGIS API for javascript. So far I managed to create empty map using this tutorial and write some code which visualizes some data.
The basemaps which ArcGIS offer are quite nice and I would like to use them, but they represent whole world and what I need is basemap of just a single country. What's the best/easiest way to do it? I tried using ArcGIS Online to edit basemap but the don't offer good options for cutting single country.
I found some links out there but they aren't solving my problem (or my knowledge is to small to understand them), for example https://developers.arcgis.com/javascript/latest/sample-code/basemap-custom/index.html
If you like the look and feel of the Esri basemaps, you don't want to make your own. That's certainly technically possible, but requires a greater command of ArcMap and publishing services -- and isn't what you're really looking for. And basemap tiles shouldn't be edited, even ones you publish yourself, since the difficulty of doing that well is just not worth the effort.
Instead, you can restrict the JavaScript map to prevent panning outside your area of interest. Whenever the user moves to an extent that exceeds allowed values, the code automatically resets the extent to the allowed limit, and they can't move outside it. (You can similarly restrict zoom levels so they won't even be able to zoom out further than the view of your area of interest.)
For code details, see existing answers on Restricting base map on specific extent in ArcGIS API for JavaScript 3? (GIS.StackExchange)

Xcode - How do you create an Activity Feed?

I'm having an issue finding information on creating an activity feed in Xcode. I am new to developing so I'm trying to find something that really breaks things down. I'm looking to create a feed similar to twitter. Does any one know what my first steps should be? or at least a tutorial I could be referred to?
Well an activity feed is at its heart a list of "posts". So first learn how to make lists. Act I is making a UITableView with custom cells.
For the basics, see this tutorial and Apple's own Table View Programming Guide. If you want a book, I recommend the Big Nerd Ranch book "iOS Programming: The Big Nerd Ranch Guide 4th Edition". Chapter 8 is all about UITableView.
Ignore the default Apple layouts, which don't look much like an activity feed yet. Once you get past the basics you'll make your own cells.
Once you've mastered the basics, focus on custom cells, as the Apple defaults won't cut it for your hot new activity feed. Here's a tutorial for custom cells.
Ray Wenderlich also has a pretty in depth series of articles you can use to drill deeper in any specific areas of interest: UITableView articles.
Then, you've got to get data into your newsfeed somehow. This is Act II. Presumably this will begin as JSON from a REST web service. So you need to connect to a web server, parse JSON, and get Objective-C classes out the other side, ready to pass to your table view.
Learn the basics of Cocoapods, then use it to install AFNetworking and Mantle.
Use AFNetworking to retrieve JSON from whatever URL, then use Mantle to parse it. I found this tutorial useful for getting started with Mantle.
After that, you should have your first activity feed!

How to add 'favorite' button in ios app

I am new to ios dev and in middle of app. I need to add button in my app which pops up two cells 1) Add to favorites 2) Show favorites.
The content needs to be added is simple string and same for show favorites.
I searched few answers but could not easily grasp.
Can someone explain the approach I should take?
You need data serialization, and/or persistance.
Small amount of data = Data Persistence.
Large = Serialization, aka Archiving. All arrays can do it, find some wenderlich tutorials.
(I can't seem to find any basic tutorials on his site or I'd link one here, all of it is kinda advanced database stuff)...
These keywords should be enough to get you going on yahoo or www.DUckDuckGo.com (doesn't personalize results, I try to get "pure" results when searching myself)

Google Maps API vs Google Maps Engine?

I'm brand new to web technologies, and in researching a web app that I want to create I got a little bogged down. I want to be able to use a Google Map on my site, including the functionality that allows you to use layers and draw shapes and lines on top of it, but I'm confused at the difference between the Google Maps API and Google Maps Engine and which one would best suit me.
Is one of those a better option for me? There seems to be a lot of red tape on getting Maps Engine for a site, but I'm unclear on if Maps API has all the functionality I'd want.
Sorry for the beginner question, but I haven't found any sort of FAQ that's addressed this. I'd really appreciate any insight. Thanks!
So Google actually offers three different products.
Google Maps JavaScript API is intended for developers, and it lets you take Google's base maps and draw on them programmatically by writing your own JavaScript that calls the API.
Google Maps Engine is for creating your own base maps. You could use it to render shapes and lines on top of a map, but if that's all you want to do, it's probably overkill (and it's not free).
Google Maps Engine Lite is the new boy in town, and it's still beta as I type this, but it might fit your use case the best: you can draw by hand on top of Google's standard maps, import a variety of formats with geo data, and then share your results or embed them on your website, all without having to write a lick of JavaScript.
It all depends on how comfortable you are with coding. Google Maps API requires the application to be built in JavaScript.
As Google Maps Engine has now been shelved by Google I would suggest taking a look at MangoMap. It allows maps to be built using only an interface, you can built really powerful web ma applications without writing a single line of code.
Disclaimer: I'm the CEO of MangoMap ;-)
With Google Maps API, Google supplies a blank map and you add points, line, polygons, etc. to the map via JavaScript. This is great until you start having to add thousands of map objects.
With Google Maps Engine, (now deprecated), you upload, store, and process the geometry data on Google's servers for optimal rendering. You can turn a large group of points and lines into image files with transparent backgrounds which can display quickly on a map.

Constructing Intersections from Google Maps API

Problem:
I am trying to reverse geocode a lat/long into a closest street intersection using Google Maps API V3. Also, for now, this doesn't have to be super accurate-- as I am just trying to anonymize an address as opposed to providing directions.
I have seen that the Geocoding Results data contains an Address Component Type of "Intersection", but this doesn't seem to be consistent at all in the return results-- and is more often that not blank.
I have also done some looking on SO for the best way to construct this barring getting it from Google directly, and the closest I have seen is: How can I find the nearest intersection via the Google Maps API?, which doesn't really resolve my issue. In light of this I have come up with my own solution, and would like some opinions, optimizations, constructive criticism, or other options entirely.
My Tentative Solution:
After playing around with the API, I decided to give the following algorithm a shot (just for context, this is written in C# within a console app):
I take an address and resolve that into a lat/long.
I then add or subtract a certain amount of lat or long from the
coordinate-- on the order of a city block (a distance which is adjusted given your
latitude) and get walking directions between the points. I do this for up to all four directions-- so the first modification would be to keep the latitude the same but subtract some longitude. Then the next modification would be to keep the latitude and add some longitude, etc.
After getting the directions, I parse the results and check the start
and end address. If they are different, I pull out the street names
and treat them as an "intersection" (even though sometimes this
results in parallel streets-- again just trying to get a ballpark).
If I don't find two different streets, I widen the distance of the end destination and repeat the process.
So far this working well enough, but obviously it is an expensive process both in terms of time, and in using up my allotted query limit. Also, I checked the API terms of service, and as long as I include their disclaimer and display the results on a Google Map I think that I am ok.
My questions for the community are:
How can I improve the efficiency of the algorithm? Specifically, in
the number of times I call the API (the implementation code is not a
problem)
Is there another way entirely to do this using the Google Maps API?
In the SO question referred to above, the solution was to loop
over building numbers. I am not sure exactly what that means-- so any
clarification would be great.
As referred to above, I do not believe this is breaking the terms of service-- but am I mistaken?
Is there another web-based API to use that may meet my needs better?
Perhaps Bing, or some other provider?
Thanks a lot for any help.
UPDATE:
I have run into my query limit for the day, so I won't be able to test any suggestions against Google today, but I am also still open to using a different API. Thanks.
Old question, but since the original poster stated they were open to solutions other than Google, Geonames has a web API for this for the U.S. See GeoNames WebServices overview and http://www.geonames.org/maps/us-reverse-geocoder.html#findNearestIntersection