Get Nearest Panorama by Location GMaps Api - javascript

I'm new here and looking for help. I tried almost everything including nodejs, embedden js and others ..
There is very cool feature of google maps js: It can show the nearest available streetview with given location.
http://bloggerbotu.com/Githadi/nearestimage.html?lat=37.952866&lng=34.151230
Here is an example. I edited it a little.
When we put our lat and long values even doesn't have street view, it finds the nearest location and shows us an image.
And you could see there is a small textbox on the upper right side of the page that shows the location of available streetviews. I need this value.
But they all in browser side. I tried with nodejs but not succesfful. I can't do that.
You'll see there is some kind of processing of queries and when you click somewhere like mountain or out of road, the process starts and find the nearest available location again. And textbox changes with
document.getElementById("koordinat").value = data.location.latLng;
I don't need images or map markers etc. All I want is, when I give lat and long, a small php script or node based server script that returns me the nearest streetview-available coordinates.
Thanks

Related

Google Maps Markers in wrong location, but lat/lon appears correct

I am using custom markers to show a semi-live view of the location and orientation (heading) of certain vehicles of interest overlayed on Google Maps. (In my case, I'm depicting aircraft, the same way Uber does for cars, or how FlightAware does for commercial flights).
The coordinates for the markers are being broadcast in JSON format to participating browsers from a server that I control. The JSON data is processed by a JavaScript function at the browser to create / update the markers on the Google map. The refresh (broadcast) rate can sometimes be as fast as once every 2-seconds, or as slow as once every 30 seconds, depending on the particular user's needs of the moment.
Sometimes, it is possible (and valid) for two markers to be thousands of miles apart from each other. For example, one marker could be in Montana, and the other could be somewhere in Africa, and this is a valid condition.
However, sometimes, when I am zoomed into a region of the world so I can look more closely at one marker, a "ghost" marker appears nearby that "isn't really located there". The ghost marker is labeled as one of the other markers that may be hundreds or thousands of miles away, but it's showing up in my zoomed in view for some strange reason. If I momentarily zoom in our out, the ghost disappears, but it may re-appear again.
Interestingly, the ghost image has the proper orientation for the vehicle it represents, but it's just located in the wrong part of the world.
Are there any special things I should be doing when I'm updating multiple markers separated by large distances so they don't show up like this in the wrong place?
I have traced this as far as putting console messages in the browser so I can see the lat/lon of each marker being depicted. I output the latLng object just before it's applied to each marker, and the lat/lon I see in the console log is correct, even when the actual marker shows up in the wrong place.
I don't know if this is a contributor to the problem, but the marker images I'm using are custom PNG files, not standard Google makers. Has anybody run into this before?
As I can see there are a couple of issues reported in the Google issue tracker very similar to the one you described here.
Have a look at them:
https://issuetracker.google.com/issues/74225068
https://issuetracker.google.com/issues/73864685
Feel free to add your comments and star the issues to subscribe to further notifications from Google.
Please note that these issues were reported for the experimental version of Google Maps JavaScript API. Double check which version of the API you are using. Probably loading the release or frozen version will work as a temporary workaround for you.
For more details about versioning model of Google Maps JavaScript API please refer to the documentation:
https://developers.google.com/maps/documentation/javascript/versions
I hope this helps!

Find frequently visited area from given set of GPS points

I am having a data set of say 10000 GPS points. I need to find GPS points depending on how frequently the area is visited by using the GPS data set I have. I am looking for a solution either by using google maps or by using mongoDB, but unable to find any clue how should I achieve this. Can anyone help me regarding this?
sample data = [{18.5204303,73.8567437},{18.520457, 73.856697},{18.520400, 73.856800},{18.520156, 73.857092},{18.519879, 73.857561}]
Out of the given data set first three point are near to each other.
So, whenever I will ask for frequently visited area from the given data set I should get result as [{18.5204303,73.8567437},{18.520457, 73.856697},{18.520400, 73.856800},{18.520156, 73.857092}]
I got the solution using google heatmap. I just passed array of gps points to heatmap and the heatmap displayed it in proportion of frequent access to the locations. That is what I was trying to achieve

Convert Google Map to static image for download using jQuery

I have a div on my website in which I have created a GoogleMap. I've added markers and implemented MarkerClusterer.
I want to allow the user to click a button and download an image of the currently viewed map as they see it after any zooming or moving including markers:
I tried to use html2canvas and that doesn't work at all.
After searching for how to do this for the last hour, I've come up with absolutely nothing useful.
Is this even possible to capture the div as the user sees it? Or is creating a static google map and saving the image the only way to do this?
SOLUTION
I went with PhantomJS in the end. I created a Map view which takes input through the querystring and uses that data to add markers to a map. I then used PhantomJS to take screenshots from the map view. I then output the screenshot image as a Base64 string.
SnapshotControl is suggested by google in such situations. The limitation is that SnapshotControl supports only URL of upto 2048 characters. So it can be used if there are not much layers drawn on map.
For phantom js, when user clicks on download, the layer data drawn on map should be send to server (through say downloadServlet). This data will be passed to a JSP that can render a map and plot point. Phantomjs will be executed by downloadServlet passing the URL of this jsp.
I have used phantomjs in my application as I draw around 4-5 different layers at a time. Only thing to note here is that the server where phantomjs would be executed needs to have internet connectivity otherwise maps will not be drawn.
Your best solution is Static Google Maps.
See https://developers.google.com/maps/documentation/static-maps/intro for plenty of examples.
Create an image in your div, I would then recommend using concatenation to produce a dynamic url from your marker/LatLng/Polyline etc variables. Then use JS to set the image's src equal to that url.
Following that, there are plenty of JS libraries that will allow the user to download the image.

How to prompt user for place using Google Maps in javascript?

I am new to Google Maps and still new to Javascript. I need to have a user select a location on a map (using Google Map) and retrieve the corresponding town, country, latitude and longitude. If timezone is available too, that would be great.
I can't find an operational code example. Does anyone have one to share? Thanks.
The sample code provided by Google at http://code.google.com/apis/maps/documentation/javascript/examples/event-arguments.html gets a LatLng from a mouse click and puts a marker on a map. (Just view the source code to see the sample code.)
The sample code provided by Google at http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-reverse.html takes a latitude and longitude and determines the location via reverse geocoding. (Again, view source code to see the sample.)
Sounds like your functionality is basically parts of each of those samples and fusing them.
You might want to check out the Events documentation and the Reverse Geocoding documentation if you run into any problems (or even if you don't).

Google Maps v3 panTo() from getCenter() lat lng doesn't go to same location

I'm using getCenter() to use the lat lng in a url so users can share / bookmark a location on Google Maps. I then use panTo() to try and jump back to the same location. Though it always jumps back to approximately the same location it's never exactly the same view.
I've thought about using setCenter() instead of panTo() but this can mess up the referencing calculation for the custom map layer I'm displaying. Depends where the center happens to be.
To see the problem in action you can go to http://www.topomap.co.nz/ and use the "Share" tab to get a url generated from getCenter(). Using the url you'll notice they show slightly different centers.
Please note that I'm currently using latLng.toUrlValue() which reduces some of the accuracy, but you can manually tweak the url from the individual lat long given in the "Share" tab and you'll still see the same problem.
Any ideas what might be going on?
You may get the bounds of the map using map.getBounds() before transition and then when you need to get back to this view use
fitBounds(bounds:LatLngBounds)
or
panToBounds(latLngBounds:LatLngBounds)
Don't know if it will work, give it a try...
Found here.
http://code.google.com/apis/maps/documentation/javascript/reference.html#Map
Seems panTo() is no substitute for setCenter(). I just have to code around my Prime Meridian issue and use setCenter() instead.

Categories

Resources