How do you fake your location with the google maps api - google-maps

I am using the google maps API to gain a users location:
https://developers.google.com/maps/documentation/geolocation/intro
To test this I would like to fake the location however setting chromes geo location does not work as it seems to ignore this.

In the maps api itself you can't fake the position because it uses the geolocation functionality of your browser. If you want to fake your geolocation in Chrome you can do it like this:
Press F12 to open the Developer Console. Change to the tab Console and open the menu with the 3 dots icon. Select More Tools --> Sensors and change the default value for the Geolocation from "No override" to a preset or enter own coordinates. Now reload the page and see how it works.
I tested it right now on this Google Geolocation Tutorial page and inside an own application with Google maps. Good luck!
It works the same way in:
Vivaldi
Opera (use CTRL + SHIFT + C instead of F12)
Different for:
Firefox (I think you have to use an extension)
Internet Explorer 11 (F12, Tab Emulation, Geolocation --> on and enter lat and lon

Related

GoogleMaps "Sorry, we have no imagery here" in InternetExplorer 11

We're using google maps to display company locations on a map. It still works in Chrome, Firefox & Safari currently, however in IE 11 today we noticed that none of the tiles are loading and we get grey tiles with a text saying "Sorry, we have no imagery here". I checked the network tab and it looks like, the tile requests are trying to fetch the tiles from the domain, where the map is displayed instead of fetching them from the google servers.
I tried changing the version parameter to v=weekly and v=3.3.6, but it still behaves the same.
The map is embedded like this:
<script src="https://maps.googleapis.com/maps/api/js?key={API_KEY}&v=3.exp" defer></script>
in IE11 the tile request looks like this:
https://example.com/google-maps-page/undefinedpb=!1m5!1m4!1i6!2i34!3i21!4i256!2m3!1e0!2sm!3i480189574!3m14!2sen-US!3sUS!5e18!12m1!1e68!12m3!1e37!2m1!1ssmartmaps!12m4!1e26!2m2!1sstyles!2zcy50OjJ8cy5lOmx8cC52Om9mZg!4e0&key={API_KEY}&token={TOKEN}
in chrome the working tile-requests look like this:
https://maps.googleapis.com/maps/vt?pb=!1m5!1m4!1i6!2i31!3i22!4i256!2m3!1e0!2sm!3i480189574!3m14!2sde-DE!3sUS!5e18!12m1!1e68!12m3!1e37!2m1!1ssmartmaps!12m4!1e26!2m2!1sstyles!2zcy50OjJ8cy5lOmx8cC52Om9mZg!4e0!5m1!5f2&key={API_KEY}&token={TOKEN}
We are also encountering the same problem.
Switching to v=3.36 solves this for now, but 3.36 will be removed next update, where it will default to the "v=quarterly" response.
I had the same issue, my site is using es6-shims library, but once I change it to core-js library, google maps 3.38 works well in IE11, not sure if it is a google maps issue or es6-shims issue.
Without any shims google maps 3.38 does work in IE11, so the issue could be incompatibility between es6-shims and latest google maps

Force Google Chrome to use computer's geolocation

I'm trying to get the location of an HP EliteBook. (in google maps and just clicking on "your position").
With Microsoft Edge I get it very precisely.
With Firefox and Chrome I have an accuracy of about 30 meters which is far too much. I managed to fix it with Firefox by changing configuration in about:config and setting geo.provider.ms-windows-location to true.
Is there any equivalent option in Chrome, I can't find anything.
Thank you.

Google maps API doesn't work in safari

hello im hosting Google maps API on my localhost for now, and it appears fine in Chrome and the mobile phone version. (both safari and chrome iPhone versions).
My problem is Google maps doesn't show when it comes to my Mac version of Safari. the Grey(background) shows and the cursors change to the Google maps cursor, but the map and content doesn't display. what can be the problem?
Here is a link to the map. as you can see the map displays in Chrome but not in safari.(at least not for me).
http://jsbin.com/cahicomame/1/edit?html,output
there is no guarantee that navigator.geolocation.getCurrentPosition will return a result. The user may deny the permission or the geolocation-service may not be able to locate the user.
You better initialize the map with a default-center (center is required to display the map).
I find the solution after 1 hours , it's because my website (developpement) was in http and not https :) Safari will ask your localisation.

Geolocation/Maps API Directions not displaying on map

In Safari I have an issue with the Google Maps API directions service. I use HTML5 Geolocation to display directions to a location on page load.
Here is a page that uses this.
http://northwestmarkets.com/all-stores/arlington-food-pavilion
What about Safari could cause this error. I works in IE, Chrome and Firefox
Open System Preferences / Security and select the General tab.
Click the gold padlock icon bottom left in the pane to make any necessary changes. You will be prompted for your admin password.
If necessary, make sure: Disable Location Services is not selected. Click: Reset Warnings.
support: http://support.apple.com/kb/HT4239
also checkout this W3C geolocation API not working on Safari 5, looks like in safari 5 geolocation only works with wifi

Open location app from webpage link from ios browser

I wish to make a link in my mobile website that will trigger a location based application (as waze or google maps) to open in location.
the following html code:
go to location
working great with android browsers, but not working with iphone (using safari or chrome)
How can it be done to work with iphone/ipad browsers?
To open google maps on ios you have to use a specific url scheme (specific for each application, if provided) for example the following will call google maps :
comgooglemaps://?daddr=%f,%f&saddr=%f,%f&mrsp=0&ht=it&ftr=0", contactPosition.latitude, contactPosition.longitude, myPosition.latitude, myPosition.longitude
and this wil open waze :
waze://?ll=37.331689,-122.030731&navigate=yes
In both cases to have this working the user, obviously, should have the apps installed.