Which Maps API should I use? - geolocation

I am creating a webpage that includes maps for my software engineering thesis. The page will include following features:
Show a specific location and save it to a database;
Showing different roads in the same map and save then to database;
Getting the nearest road that passes nearby a specific location pointed by a user - a little search function;
Users might be allowed to create different roads, which can be saved in a database.
The thing is that the service (API) used should be free. For this reason, we might not be using Google Maps.
We are using Java for the Model Classes.
Which maps API can I use?
How can I ask it which of the roads is nearest to a certain point (location) on the map?

Google Maps API is Free as long as you are not using more than a certain amount of traffic. If its for a class project it should be fine, but if that project turned into a commercial site, it would become expensive.

Related

Machine Learning with APIs and storing results

I have a (commercial) machine learning project where I want to enrich the existing information with data from different API sources (like Google Places, Facebook Graph), save this in a database and analyse the whole data with machine learning algorithms (e.g. perform clustering).
But according to e.g. Google Places caching and storing data is not allowed:
3.2.4 (a) No Scraping. Customer will not extract, export, or otherwise scrape Google Maps Content for use outside the Services. For example, Customer will not: (i) pre-fetch, index, store, reshare, or rehost Google Maps Content outside the services; (ii) bulk download Google Maps tiles, Street View images, geocodes, directions, distance matrix results, roads information, places information, elevation values, and time zone details; (iii) copy and save business names, addresses, or user reviews; or (iv) use Google Maps Content with text-to-speech services. https://cloud.google.com/maps-platform/terms/#3-license
3.2.4 (b) No Caching. Customer will not cache Google Maps Content except as expressly permitted under the Maps Service Specific Terms
https://cloud.google.com/maps-platform/terms/#3-license
5.4 Caching. Customer can temporarily cache latitude (lat) and longitude (lng) values from the Places API for up to 30 consecutive calendar days, after which Customer must delete the cached latitude and longitude values. Customer can cache Places API Place ID (place_id) values, in accordance with the Places API Policies.
https://cloud.google.com/maps-platform/terms/maps-service-terms/
How did you proceed in similar projects? Is it really caching what I want to do in the project or is there a slight difference? I've made a request to Google but they couldn't answer this question on the telephone. And I need to store the data somewhere to be able to perform the machine learning algorithms.

I need an API to plot waypoints and give me a route through them, and to give me city population. Which API should I use?

I'm making an iOS app that needs to be able to find the most populated cities within a radius from a certain point, and to calculate a route that passes through a certain number of those cities, that satisfy a certain time constraint. I'm planning to use Google to give me polylines that I can put directly on an Apple Map in the Mapkit for Xcode. I've looked into the Google Maps SDK for iOS, and Google Places. Google also has a Directions API, and a Distance Matrix API. With so many API's, I'm slightly confused about which one I should use, and for what.
Additionally, do Google API's provide city population, or should I find that via another database?
You can use Google Maps URL Scheme to get directions for Google Maps iOS.
If you are ever confused about which API to use for Google Maps, you can use API picker.
There is no Google API that give city population, so you would need to find it with a another database.

Accessing Map Tiles of MKMapView

I'm currently developing an app that needs to display a map of where the user is currently located in the world. For technical reasons, I need to access every map tiles as an image (png/jpg) before going in the rendering pipeline.
I have tried 3rd party services like MapBox, MapQuest as they have a REST api that enables me to receive a png/jpg of a tile according to the requested location. The issue here is that MapBox isn't free, so I was wondering if there was a way to access the tiles that Apple provides in it's maps app. What service are they using under the hood? Would I be violating some terms of use by going with this approach.
Please note that using some integrated "do-it-all" UIMapView is not an option for me, I need the image directly.
Thanks
Google has a REST API. You can see the details here https://developers.google.com/maps/documentation/staticmaps/?csw=1. It does cost money if you go over the usage limits.
I manually download Map Tiles for my app, but I don't use MKMapKit. I have my own MapView and I am using a combination of MapBox, Thunderforest, CalTopo, OSM, and map tiles that I generated and host on AWS. All of them have a pretty easy map tile URL scheme, but you do have to pay for most of them.

Geolocation and getting a city from an input address (Rails)

The app I'm building needs to be able to match up users to events based on the city/town they're in. I'm still relatively new to Rails and completely new to Geolocation and using locations in an app. I'd figured on a design where users have one or many cities, and events would have one city which I'd hoped to extract without specifically asking the user for it, by getting it from the event address entered.
Mostly to provide some outside checking to help get the address entered correctly and consistently, but also to show a map, I installed this jquery address picker (https://github.com/sgruhier/jquery-addresspicker). Unfortunately the data returned by Google doesn't include a city but a "locality" or an "administrative area" that doesn't correlate reliably to city names. The localities being returned are more like what we in my home town would call "suburbs". What I need to procure is a city so I can allow users to search all events in their city rather than just the ones in their suburb.
Can anyone offer advice on how I could go about doing this? Many thanks.
Edit: Should maybe add that I'm wanting to do geocoding client-side so I don't run into problems with Google Maps limits or have to pay for geocoding etc.
There are some gems that provide you with that and may others geo related features, like calculating distances.
Here are the 2 most famous: https://github.com/alexreisner/geocoder and https://github.com/imajes/geokit
In the future I highly recommend you to head to https://www.ruby-toolbox.com/ to see what is available as a gem already and see what is the most popular at the moment.
For raw address info, use Google Maps API Reverse Geocoding which accepts lat/lon inputs and returns street address components. Modern browsers support location awareness (geolocation), with user permission, and will give you a lat/lon that "tends to be close" to where the browser is. That will probably get you a correct city/town in most cases.
The maps API is part of Google's broad suite of API tools -- there are gems that handle any Google API (well, most of them), or check out Google Maps for Rails, which will at the very least give you a good head start on how to use the API.
But if you're looking to validate postal code, this method will come up short, since the location awareness will vary in accuracy depending on browser, device (more accurate for mobile), the connection, population density, network coverage, and so on. Also, calling the
If you can get GPS-accurate lat/lon then it will be much more accurate ... except in some cases like in large cities, a single building will have its own postal code, so a few feet one way or the other might matter.

Building a Bing Store Locator

I've tried Google but I'm not smart enough to build my own Google Store locator. Everything is either old or in PHP and I use Python. Even GAE uses Python but I can't find any tutorials for Python at all. I even had a bounty here on S.o. for resources to a Python store locator and the only answer had a post from 2008 that was updated to "deprecated" on the post itself.
So I decided to give Bing a try and it has more noob options, such as "enter address here" and then it's listed in the app. The only problem is that everything is pointing me to Bing Spacial Datasend and it says they want to charge an arm and a leg.
Also, if you know of any, are there any good tutorials on building a Bing Store Locator? Google search has come up empty for me but they could always be hiding them. Thanks.
If you have less than 50 locations you can use the Bing Spatial Data Services under the free terms of use. If your application is a public facing web site, which most store locators are you can also generate 125,000 transactions against Bing Maps for free per year. If this is enough or not would depend on the number of stores and customers you have. The Bing Spatial Data Services is a really good option as you simply upload your data and it exposes it as a spatial rest service for you which you can access directly from JavaScript without the need for any server side code. Here is an example of how to query a data source in the Bing Spatial Data Services: http://www.bingmapsportal.com/ISDK/AjaxV7#SpatialDataServices1
If your application has a lot more volume then you would need a Bing Maps license. The cost of a license varies depending on the amount of transactions your application will use. If you have a Bing Maps license data sources can have up to 600,000 locations in a single data source and each Bing Maps account is allowed up to 25 data sources.

Resources