How to fix Uncaught InvalidValueError: setPosition: not a LatLng or LatLngLiteral: in property lat: not a number?

Uncaught InvalidValueError: setPosition: not a LatLng or LatLngLiteral: in property lat: not a number Means you are not passing numbers into the google.maps.LatLng constructor. Per your comment: /*Information from chromium debugger trader: Object geo: Object lat: “49.014821” lon: “10.985072” */ trader.geo.lat and trader.geo.lon are strings, not numbers. Use parseFloat to convert them to numbers: var … Read more

Animating Multiple Markers

If you want to animate multiple markers you will have to change the animate and startAnimation functions to handle multiple markers (probably make all the variables into arrays). example code snippet: var map; var directionDisplay; var directionsService; var stepDisplay; var position; var marker = []; var polyline = []; var poly2 = []; var poly … Read more

CORS and Google Maps Places Autocomplete API calls [duplicate]

The supported way to call the Place Autocomplete API from a web app is using the Places library: <script> function initMap() { var map = new google.maps.Map(document.getElementById(‘map’), { center: {lat: -33.8688, lng: 151.2195}, zoom: 13 }); … map.controls[google.maps.ControlPosition.TOP_RIGHT].push(card); var autocomplete = new google.maps.places.Autocomplete(input); autocomplete.bindTo(‘bounds’, map); var infowindow = new google.maps.InfoWindow(); var infowindowContent = document.getElementById(‘infowindow-content’); infowindow.setContent(infowindowContent); … Read more

Google Maps close previous Infowindow when another marker is clicked

Don’t create multiple Infowindows if you only need one to be open at a time. You only need one instance of the Infowindow object and set its content depending on which Marker you click by using the setContent() method. You also need to use a closure around your marker click listener. Something like that: google.maps.event.addListener(marker, … Read more

Request main road / curbside StreetView panoramas instead of back alleys from API

Use the directions service to get directions from the desired address to itself. Use that location instead of the geocoder result for the street view location. Use the geocoder result (hopefully a ROOFTOP accuracy result) for the place to look “at”. related question: Facing the targeted building with Google StreetView Examples: 325 S Peck Dr, … Read more