Filter Google Flights Results - javascript

Is there some javascript I can use to filter the results displayed on This Map by price ?
Looks like there are lot of different calls but I can't figure the object/array I should filter on.

Turns out the page before the Flight Maps page on google flight allows you to set a max price.
That's then reflected in the flight maps page URL in the mp param (assume it means max price)
https://www.google.com/flights/#search;f=SFO;d=2014-12-04;r=2014-12-08;mp=450;mc=m
Saves the trouble of having to write any code.

Related

Calculate journey time between two locations (co-ordinates) using google maps api

I have co-ordinates of the start and end location. I want to calculate the total time taken to reach the end point. Is there any google maps static api in which i will pass co-ordinates of the start and end location, and in return it will give total time taken to reach the end point from start one ?
An example of google maps static api is something like this :
https://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap&markers=color:red%7Clabel:C%7C<longitude>,<lat>?&key=<api key>
This will return the static map of the given co-ordinates.
For this you have to use Google Directions API
If you have two co-ordinates and you want to know about the total time taken to reach one point, you can do this by passing your co-ordinates as a parameter in this query.
https://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&key=YOUR_API_KEY
The response will be a object and in this object there will be all the data that is required for this journey i.e total time, checkpoints, etc
Take a look at this example.

Not getting any nearby restaurant using Google place API

i am trying to get a list of all restaurants near user Location. For some co-ordinates i am getting results but for some location i am getting nothing. For example:
Getting no results for this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=77.04744149999999,28.5080526&radius=50000&type=restaurant=&key=%20AIzaSyBwJsemNhTY8_HZDc3wAfhUrY0xrLm6EWY
Note : Above coordinates are for Gurgaon sector 23 A Loaction
Getting Results for this:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=41.6639,-83.5552&radius=50000&type=restaurant=&key=%20AIzaSyBwJsemNhTY8_HZDc3wAfhUrY0xrLm6EWY
can anyone tell me what is wrong going on here with me.
I can think of two main reasons:
1. The coordinates you are using are invalid.
OR
2. There are simply no restaurants nearby that are registered in the Google Place database.
Other than that I don't see any mistakes in the way you are using the API (I get the same result, by the way).

How to get cities near my

I want to get all cities close to my actual geolocalisation (by GPS) in a X radius. A good example is the app Tinder. The user select the value of radius in KM and the app gets all the cities close to his geolocalisation inside the selected radius.
I want to calculate the radius and get all cities within by javascript or PHP.
An illustration:
You can download a database of all US cities, with their states and latitude/longitude, then query the database based on current GPS info. Just google search for a DB, they are about 30 meg, so make sure your queries are optimized.
Here is a db that should work...
https://www.maxmind.com/en/free-world-cities-database
If you can find a geospacial database it would perform better (not sure if linked one is or not). I have used a non geospacial one and it was fine though.

How do I make a Google Fusion Tables map that displays only data from the latest date?

Here is a link to my Fusion Table.
If you look at the column labeled 'date', you can see two dates: 7/4/2012 and 7/5/2012. To the left is the column 'price', which changes depending on the date.
The map I am making is Geocoded according to the four U.S. Census Regions: Northeast, Midwest, South, and West.
I'd like to make a map that displays the price of the latest date.
So, in this case, clicking any Northeast state would show that 'price' is '0'.
Does anyone know how I can make this happen?
One way would be to use the google visualization library. On click query the table for the region, order by date, limit 1 extract the price and display it.
Here is an example that uses a gviz query to put data in the infowindows.
This example might be more useful, it puts all the rows returned in an infowindow and allows the row to be dynamically selected, that part doesn't seem to work in IE8, but you don't need to dynamically change the data, since you only want the latest value.
Here is an example which does what I think you want using your data.

Find cities within given mile radius from address

I'm using CakePHP/mysql to build my app and I'm trying to get a list of cities within a given mile radius around an address both supplied by the user. So far I have a list of all US cities in a database with the long/lat. I also am using a CakePHP plugin to get the long/lat of all addresses inserted into the database.
Now how do I do the last part? I'm new to the google maps api but it looks like there is a limit on how many queries I make a day. The only way I can think to do it is to check the distance from the address and compare it to every city in the database and if it is within the given radius then they are selected. It seems like this would be way too database intensive and I would pass my query quotas in one go.
Any ideas?
It sounds like you're trying to determine if a given point (city) is within a circle centered on a specific lat/lon. Here's a similar question.
Run a loop over each city and see if it satisfies the following condition:
if ( (x-center_x)2 + (y-center_y)2 <= radius2 )
If this is too slow, you could turn it into a lookup based on rounding the lat/lon. The more values you precompute, the closer to exact you can get.

Categories

Resources