Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm in doubt if Maps API has something to do the following: I have a list of places in my local database. Each one with the address (street, city, state, etc...) and maybe with lat/long (I can retrieve this data if needed).
I'm looking for a solution for the case that in a webpage with a Google Maps plotted, the user enters an arbitrary address and get which is the nearest place from that local database I have.
I know I can get this address' lat/long and with some simple math (Pythagorean theorem) I can calculate each distances, but this is not the same when one need to know the distance by driving.
EDIT: I found this solution https://developers.google.com/maps/articles/phpsqlsearch_v3 and it looks a good one. Is the best approach?
You can use Distance Matrix API:
Distance Matrix API Documentation
It's easy to retrieve distances with a simple call:
https://maps.googleapis.com/maps/api/distancematrix/output?parameters
The response is in JSON or XML format depending on your choice. But there are limitations on the number of elements for a single query. You can first choose the locations around the user with a constant radius with simple math and then use Distance Matrix when the number of locations are small enough to send in a query.
The above method takes radius as parameter to search nearest locations. Instead of that you can simply get some nearest destinations and pass origin and destination to google direction api to get json or XML data. you can then extract driving distance from it.
See the link for more details: https://developers.google.com/maps/documentation/directions/#JSON
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 days ago.
Improve this question
I have a script running in Node.js that creates map images based on city, state input. I want to use an API or url request to retrieve a recommended lat, long, and zoom level for the map image to center on the city and include most of the city in the view (the intended output is a square). Is there a simple way to retrieve this using Google Maps or the equivalent?
When I use a browser for google.com/maps and enter the city and state, the browser updates to a url which has all of this information. For example:
https://www.google.com/maps/place/Portland,ME
Is updated to:
https://www.google.com/maps/place/Portland,+ME/#43.6670104,-70.2115149,12z
Which has all the information I need to parse out lat, long, and z, but it doesn't update the url with a header redirect that would be easy to use the http module to get. Instead, it seems to be a delayed JavaScript action.
Any ideas?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I volunteer at nonprofit, and we currently run our website through Squarespace. We have hundreds of web pages set up to sponsor our children. Every few months when we want to update their personal information, we have to go into each web page and retype all the information. We keep all our information in a google excel sheet.
My question is: Am I able to link cells from the Google Sheet to specific values on each child's webpage? That way, when the excel sheet is updated (favorite activity, favorite color, grade, age...etc.), it can all be updated through the Google Sheet instead of having to first update the Google Sheet, and then updating each individual webpage. I've been researching this for days now, and I feel like it may be possibly with JQuery, but I feel very limited with Squarespace's capabilities. Thanks!
The short answer is yes.
You can use a google sheet as a database for any application, update and manipulate data.
I have been doing that for a long time now. Google has recently released its Google Sheet API V4 (the current) the last version.
I followed this tutorial: https://developers.google.com/sheets/guides/concepts
. On the left panel, you can choose the programming language you wish to develop under Quickstart.
It supports:
PHP.
Android.
Java.
Node.js.
Python.
Ruby.
Perl.
Go
iOS
.NET
The trick is that you need to set an ID for each record which refer to the line number. Your column should also be fixed. This is because queries in Google Sheet API refer to the column number and row number. (Known as index).
You can check the following repository that i once used to do this same thing.
https://github.com/souparno/google-sheet-database
Some of the api calls might be old and needs to be updated.
this is a quick answer, i will update more when i get some time
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a list of Latitudes and longitudes obtained from my API; this is an AngularJS application.
I want the user to see a google map showing the position of these coordinates on the map.
I have looked into iFrame but it shows a blank page because I cannot update these lat and lng.
So how can I implement google maps on my application where when selected coordinates it will show a map with the marker of where those coordinates are.
Do I need a controller? With AngularJS directives how would I use them?
I am completely new to AngularJS.
You can use the Google maps API. Just enter the lat long coordinates, based on the user's input. This should get you started: https://developers.google.com/maps/documentation/javascript/tutorial?hl=nl
Here you can find the angular js directives to integrate google maps into your application: https://angular-ui.github.io/angular-google-maps/#!/
UPDATE
I created an example for you, I think this is what you are looking for:
google mapshttp://plnkr.co/vcx6dIUSa0MsjTWXCkIV?p=preview
its easy just
Goto : https://www.google.com/maps/preview
search the desired location
login your google account
share and embed map your google account
copy paste the code you get in to you html
hope this helps
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is someone know a online Google Map "LatLng" generator that can give all "LatLng" when i click and save my multiple clicks "Latlng" that i can copy.
Please help me.
I'm not sure if I understand correctly what you are looking for, but when you mean that you are looking for a way to collect the LatLng's for clicks on a map you only have to observe the click-event of the map and store the latLng-property of the click-event somewhere(e.g. in a element in the page where you can select and copy it).
Sample: http://jsfiddle.net/doktormolle/JM8H8/
Without more details, the first answer which comes to my mind is : It is impossible to get all latitude / longitude of the world. It's like if you tried to get position of all points on the Earth, that makes no sens.
If you want to test your application with a lot of markers, just generates random coordinates (in a for loop for example), then, do what you want with these coordinates.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have something very similar to this D3 example with the difference being a single state instead of the entire country. I would like to extract the "view bounds" in latitude/longitude after the user has zoomed in to a certain degree so that I can provide information back to them on that area.
It seems it would be some combination of:
d3.geo.bounds/path.bounds (doesn't take zooming/panning into account)
the SVG's translation/scale
projection.invert?
I see a bunch of examples for lat/long points to cartesian space using the projection() function but nothing going in the other direction (e.g. clicking arbitrarily on a map -> lat/long, displaying lat/long of the center of the map which changes with zoom/pan, etc.)
D3 has the invert() function for this. It does exactly what you want it to do -- you pass it screen coordinates and it returns unprojected coordinates.
This function is a member of the projection, so as long as you're using the projection to do zoom/translate, you don't need to account for that explicitly. To get the corner points, you can simply take the center point (which you know because that's how you set the zoom) and the dimensions of the SVG.