How to get the zoom level on maps.google.com using JavaScript? - google-maps

I'm using bookmarklets to compare maps from different providers. I would like to get the zoom level from the current map showing on the maps.google.com site.
This is the only working solution I've come up with:
var zoom=gApplication.getPageUrl().split('z=');var z=(zoom[1].length>2 ? zoom[1].substring(0,zoom[1].indexOf('&')) : zoom[1]);
It's working OK for now, but I'm not feeling comfortable with it...
I have tried map.getZoom() , but map isn't correct for the maps.google.com -site. It works on some other sites where the map-variable has been named map.

you can use map.getZoom();
for more refrence read at http://www.w3schools.com/googleAPI/ref_getzoom.asp
hope it helps you out..

Related

Remove "Google map" dashed border

i am not fluent in js and Html, i am trying to fix the map on our website that shows dashed border :
And the actual map look like this (on google map) :
There is a political issue and google shows the map without border(dashed) to users inside Morocco and show the other map to the rest of the world users, we need to fix this as 90% of the target users on our website are from Morocco.
I have tried to fix it using this method :
https://daker.me/2017/08/fix-morocco-borders-on-google-maps-2017-version.html
But either the map vanish or no changes, the original map code :
http://pasted.co/46e7141b
I also tried to change the Google Map API domain from google .com to .co.ma
Please if there is any solution i would like to fix this as soon as i can, thank you in advance.
This sounds like something that you may not be able to change, but some of the styling of the map certainly can be altered. Google has a great tool here you can check out to investigate with:
https://mapstyle.withgoogle.com/
Further details can be found here:
https://developers.google.com/maps/documentation/javascript/styling
Use region=MA query parameter in your API calls, see localization docs,
and demo.

Remove Google Map Marker Text

I have a client who has embedded Google Maps showing the location of a new hospital they are building. Until recently it just showed the pin marker, however now it is showing the longitude and latitude next to the pin. I have tried everything to remove this text but none of the options in the query string appear to do anything.
I think Google has updated the embed code but I can't find any documentation about it though. Does anyone have any suggestions?
Thanks
John
From the research I did, it seems like the new Google maps is pretty rigid and there isn't really a simple way. I think it would require some more complex API stuff.
This is the post that I found that described the limitations Removing the info window from an embedded map in the new Google Maps
Sorry I realize that doesn't really help.

Google maps in Morocco

I would like to use Google maps in a Webapp that is targeted for Moroccans, the thing is the map works fine but the borders for Morocco is not complete. it's a political issue and I'm afraid that is going to cause problems for me. My question is: Is it possible to load in my App a different map that shows the Moroccan perspective of the borders knowing that I've seen it before in a GPS App that uses Google Maps. I tried using a different domain like maps.google.co.ma instead of maps.google.com but it didn't work.
Thanks a lot!
Just set region:"MA" in your API call options
if you're using a link
https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&region=MA

Google Maps disable directions and display map directly

I have searched on the internet to find out solution to this issue but i found nothing.
I have following address:
https://maps.google.com/maps?q=2755+Maple+Avenue,+North+Bellmore,+NY+11710&daddr=2755+Maple+Ave,+North+Bellmore,+NY+11710&oe=utf-8&client=firefox-a&channel=fflb&hnear=0x89c27ef151e2fa7d:0x2fde552872337fca,2755+Maple+Ave,+North+Bellmore,+NY+11710&gl=us&t=h&z=16
open in new window
When i click on above link in a mobile browser it opens a new page but instead of mapview it shows me directions panel, any one guide me how can i get rid of directions and display only mapview directly?
i have found a parameter dir=0 but i dont know where to use it.
any help would be appreciated.
https://maps.google.com/maps?q=2755+Maple+Ave,+North+Bellmore,+NY+11710&hl=en&sll=40.684429,-73.529315&sspn=0.010983,0.026157&t=h&gl=us&hnear=2755+Maple+Ave,+North+Bellmore,+New+York+11710&z=16
use this in your map may be its helpful for you

Is it possible to customize Google / Yahoo Map?

I'm absolute newbie as for Google Map / Yahoo Map. I would like to know if it is technically possible to ask to show any city in any country DYNAMICALLY (I mean by passing parameters) and then to show some pictures OVER the map near the city ?
Thanks.
There's a multitude of ways you could accomplish this, some prettier than others.
You could use GInfoWindow to display a popup window with pictures in it at any location.
You could use one of the handy libraries offered here http://code.google.com/p/gmaps-utility-library-dev/ to assist you in displaying those images.
What I would recommend, however, is using http://econym.org.uk/gmap/ewindows.htm to create a window that is similar to GInfoWindow but that is styled by you. Just style the window so that it appears to simply be an overlaid picture.
You could choose to fool around with z-index's and manual positioning with a JavaScript library like jQuery.
Also, to answer the beginning of your question yes you can refocus the map anywhere using GMap's .setCenter() method. Documentation of setCenter(), GInfoWindow and much more available at http://code.google.com/apis/maps/documentation/reference.html
I just started learning this myself.
Here is a good link to get started:
http://code.google.com/apis/maps/
On your second question,
show some pictures OVER the map near
the city?
I like #andykram's response above, but I've implemented this previously using the Panoramio layer available for the Maps API. It can get a bit crowded but its an interface people are used to and because it is so simple to include it in a map, it just be the solution for you this time.
Just add the following to your map initialisation function.
var myLayer = new GLayer("com.panoramio.all");
map.addOverlay(myLayer);
As far as dynamically showing any city in the world in a Google Map, the solution is easily implemented - you need to geocode the name of the city. This can be done by triggering a function on an event like onclick.
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
If you hit a hurdle, try this first - http://econym.org.uk/gmap/ - possibly the best resource for the GMaps API on the web.
GeoExt is a nice framework if you work with maps in general. You can access other kinds of maps too (OSM, GeoServer).