I'm using google static maps
I'm trying to display 2 groups (with option for more) of geo points.
Each group has different icon.
this url displays only the center icon with out others
http://maps.googleapis.com/maps/api/staticmap
?center=31.909440199627042,35.00186054020873
&zoom=14
&size=1200x1200
&markers=icon:http%3A%2F%2Ftinyurl.com%2F2ftvtt6|31.909440199627042,35.00186054020873|31.909440199627042,35.00186054020873
&markers=icon:http%3A%2F%2Ftinyurl.com%2F2ftvtt6|31.909440199627042,35.00186054020873|31.909440199627042,35.00186054020873&sensor=false
What am I doing wrong?
The problem is your request:
http://maps.googleapis.com/maps/api/staticmap
?center=31.909440199627042,35.00186054020873
&zoom=14
&size=1200x1200
&markers=icon:http%3A%2F%2Ftinyurl.com%2F2ftvtt6|31.909440199627042,35.00186054020873|31.909440199627042,35.00186054020873
&markers=icon:http%3A%2F%2Ftinyurl.com%2F2ftvtt6|31.909440199627042,35.00186054020873|31.909440199627042,35.00186054020873&sensor=false
First: why do you have 2 markers fields?
Then: your markers are at exactly the same locations... So you see only 1 pin.
If I try the following (removed the 2nd markers and changed a value) I see 2 pins:
http://maps.googleapis.com/maps/api/staticmap
?center=31.909440199627042,35.00186054020873
&zoom=14
&size=1200x1200
&markers=icon:http%3A%2F%2Ftinyurl.com%2F2ftvtt6|31.909440199627042,35.00186054020873|31.909440199627042,35.0000
&sensor=false
Related
I want to create an indoor google virtual tour using google street view. I've read all Google street view documentation specially "Providing Custom Street View Panoramas" part. but honestly I didn't get how to implement an indoor virtual tour. Let me explain the case. Suppose that I have two panorama images a and b.
image a:
1) How can I put those two white arrows in the images. and how can I set their position to point a correct position?
2) How can I link image a to b. so that when user clicks on one of the white arrow can navigate from image a to b?
3) how can I put that mouse pointer (gray arrow surrounded by a circle) to my images?
4) how can I add the cross sign on the images?
I am thankful if you give me some sample code other than those that I've seen on google street view documentation.
1/2 are demonstrated in this example.
function getReceptionPanoramaData() {
return {
location: {
pano: 'reception', // The ID for this custom panorama.
description: 'Google Sydney - Reception',
latLng: new google.maps.LatLng(-33.86684, 151.19583)
},
links: [{
heading: 195,
description: 'Exit',
pano: outsideGoogle.location.pano
}],
The links block creates white arrows, at specificed headings, to other panoramas (in this case, back to a default Street View one).
I have got a drop down of State and cities .
Upon selection of a State , corresponding cities will be displayed and once clicked on Go button , i am showning that particular city uisng Google Map.
Could you please let me know if how is it posible to show that area around dashed or dotted lines ??
I see that Poly line doesn't suit my requirement as it draws only one line .
Right now i have got only latitude and longitude obtained via
$(document).on('click', '.gobtn', function(event) {
$.getJSON('https://maps.googleapis.com/maps/api/geocode/json?address=' + address + '', function(data) {
latitude_res = data.results[0].geometry.location.lat;
longitude_res = data.results[0].geometry.location.lng;
}).done(function() {
});
});
This is my simple jsfiddle how i am showing map
http://jsfiddle.net/ZLuTg/1010/
Could you please let me know how to draw dashed / dotted around the boundary of latitude amd longitude ??
How to draw boundary around the address based on latitude amd longitude
If have a way to find the boundaries for the location you can use polyline to draw the border. Just close the shape, by joining the first point back to the last point.
If you don't already have the boundaries, according to the answer to this question Google Maps API V3: How to get region border coordinates (polyline) data? and others, google maps will not provide the boundaries for you.
I have a Google Maps with a FusionTablesLayer showing railways in Germany (the fusion table can be found here). The geometry column contains the LineString coordinates of each feature.
var railwaysLayer = new google.maps.FusionTablesLayer({
map: map,
query: {
select: 'geometry',
from: '1cVaJLbbxgBErP8PzYkHP-lpWMN8wUmINbdAJS1Y'
}
});
When a user clicks on a railway, i need to know which row (or feature actually) got clicked. This can be done in the click event handler like this:
google.maps.event.addListener(existingRailwaysLayer, 'click', function(e) {
console.log(e.row.geometry.value);
});
This works as expected, but here's the problem: This table got uploaded one month ago from a KML file as a test. I've imported the exact same KML file on a different account today (here), and the geometry column isn't being returned anymore in the event handler.
I checked all the settings and found out that in both tables, the geometry columns are of type Location. However: in the first table, the rows are NOT geocoded. File > Geocode > Begin geocoding effectively starts the process of geocoding each row, while in the second table it says: 'Column is fully geocoded'.
Since everything else is exactly the same, this could very well be the problem. I don't know how to 'un-geocode' the rows in the second table. Since the first one got uploaded a month ago, my guess is that Google now automatically geocodes the rows.
Is there any way to get the geometry column of the feature that got clicked?
Note: It's definitely possible, even when the geometrycolumn is geocoded. In the 'Map of geometry' tab of the second table, you can select the columns that are shown in the infoWindow when a feature is clicked. See here for a working demo.
rows with KML-data will not be included in rows (I'm not sure if this always has been).
I guess the KML-features have been ommitted to save bandwidth
What you can do:
Parse e.infoWindowHtml (as you have noticed it's possible to print the geometry-feature in the InfoWindow, e.infoWindowHtml contains the string used as content for the InfoWindow).
But the automatic InfoWindow-template only shows the coordinates, use a dynamic template, e.g.
{template .contents}
<div class='googft-info-window'>
<b>description:</b> {$data.formatted.description}<br>
<b>name:</b> {$data.formatted.name}<br>
<div style="width:0;height:0;overflow:hidden;">[[{$data.value.geometry}]]</div>
</div>
{/template}
(You may use this template with your table, I've created it, it has the templateId:6)
As you can see the geometry is embedded in a div with no size, yit will not be shown inside the InfoWindow.
The geometry is enclosed by square brackets, use RegExp to find it:
google.maps.event.addListener(railwaysLayer, 'click', function(e) {
var str = e.infoWindowHtml, geo;
if(geo=str.match(/\[\[([^\]]+)]]/)){
geo=geo[1].replace(/(>|<)/g,function(x){
return((x==='>')?'>':'<');
});
console.log(geo);
}
});
Demo:(using your table with my template) http://jsfiddle.net/doktormolle/9YdKW/
Is it possible to plot two routes at same time with Google maps api.
For Example
Route from city A to B
and Route from city C to D
In this case A,B and C,D are separated.
Thanks.
Here are two polylines on the same map; there doesn't appear to be a limit.
http://jsfiddle.net/Lqcde/3/
I didn't add the div panels (becomes too cluttered) but you can also show two sets of text directions. It's a bit confusing because both start points are shown as "A" and endpoints, "B". Add the following lines:
directionsDisplay.setPanel(document.getElementById("dir-1"));
directionsDisplay2.setPanel(document.getElementById("dir-2"));
<div id="dir-1"></div>
<div id="dir-2"></div>
I have a question about the GOOGLE MAP API. If you have more than two data that share similar address, how do you show the Pins Drop on the same address?
Example
You have data such as the following:
Name=>Ray | Address=>Melon Park, California, USA ;
Name=>John | Address=>Melon Park, California, USA ;
Name=>Steve | Address=>Melon Park, California, USA
You want to display 3 Pins Drop for the similar address on Google Map.
The post linked above has some good advice. Your options are really:
Offset the markers slightly, so instead of displaying them all on the same they are all on really close to each other. Just add add or subtract small delta to each of them.
Use different icons for each location. If you know the maximum number of markers that could overlap (like 4?) at the same location, you could make your own rotated icons, so instead of pointing "down" in the typical teardrop shape they could point left, right, or up.
Handle the data overlap in your infowindow / UI.
Adding small delta will work like this (this script is written in PHP):
$random_num_lat = .00065 * mt_rand(1, 10); // delta to the lat value added
$random_num_lng = .00065 * mt_rand(1, 10); // delta to the lon value added
$lat=$row['lat']+$random_num_lat;
$lon=$row['lon']+$random_num_lng;
//now in loop it will be three `enter code here`marker display seperate to each other
while ($row = mysql_fetch_array($query)) {
echo ("addMarker($lat, $lon,'<b>$name</b><br/>$desc1');\n");
}
I achieved this using a "spiderfier" to "spiderfy".
There is a GoogleMaps v3 Spidifier available here (demo).
Leaflet.js can also load GoogleMaps v3 and has a beautiful clustering spidifier available here (demo).
Note: Following is a more of hack than a solution:
Write an algorithm that checks for repeated coordinates in array.
When a duplicate is found, add a small value such as 0.000001 to the found coordinates.
Note that the smaller the value the more you have zoom in to see the difference.