google-maps-api-3

Do I need to hide API key when using google maps js API? If so, how?

烂漫一生 提交于 2019-12-21 03:15:19
问题 According to https://developers.google.com/maps/documentation/javascript/tutorial#HTML5 , it seems I can add the following tag to my html and start using maps js API. <script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"> </script> But this will reveal my API key. After searching on google and browsing answers on stackoverflow, I feel that maybe there is no need to hide this API key. I just need to set the referer when I create the API key on

Styling kml with css in google maps v3?

独自空忆成欢 提交于 2019-12-21 03:12:12
问题 I am using a google maps api v3 to load some data from a kml file. I wish to style the description data when it is shown in an info window to suit my web page. Now I am trying to set the style: style="margin-left:-20px;border:2px dotted #897823; et-a;" ...inside the description tag of a Kml Placemark but it is not rendering it properly. I can see that firebug just shows up the positives values of margin and padding. It entirely ignores the negative margin values. So, I was wondering, are any

How in google maps v3 set polyline with points which link lines with bold dots

烈酒焚心 提交于 2019-12-21 02:57:11
问题 Does polyline support points so they will be displayed like this: I am trying to implement it but can figure out how to set points. With this code: polyline = new google.maps.Polyline({ path: coordinates, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 4 }); map.setCenter(new google.maps.LatLng(response[centerIndex].Lat, response[centerIndex].Long)); polyline.setMap(map); I can do just only this: You will see that the dots are not shown between lines. Is it possible to display the

Google Maps API V3: Bound world to fit area and disable map repeat

烈酒焚心 提交于 2019-12-21 02:57:08
问题 Setting the center: new google.maps.LatLng(0,0) will set the center of the world. And zoom: 1 makes the default zoom to whole world. Question is, given the size 616px by 310px of the map how can we modify/resize the map so it fits the given size nicely. For example only one instance of world gets shown and bottom of the map will be the bottom of Africa. So subsequently world map will not repeat. To be precise making our map bound like this: This is what I have got so far: 回答1: The 'picture'

How to detect if google map loaded successfully

你。 提交于 2019-12-21 02:54:19
问题 I'm using google-maps version 3 in my website. I ran through problems where the map sometimes does not load, but instead it will be shown as a grey box, and the browser log will be fulled with errors - unfortunately I can't get the log now because the map is working again. According to some researches, the problem is because of the experimental version I'm using <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=false"></script> Is There a way to find out if the map has

Pan point on Google Map to specific pixel position on screen (API v3)

痴心易碎 提交于 2019-12-21 02:53:28
问题 When overlay is a Google maps overlay and offsetx, offsety is the pixel distance from the maps center that I want to pan latlong to, the following works. var projection = overlay.getProjection(); var pxlocation = projection.fromLatLngToContainerPixel(latlong); map.panTo(projection.fromContainerPixelToLatLng(new google.maps.Point(pxlocation.x+offsetx,pxlocation.y+offsety))); However, I don't always have an overlay on the map and map.getProjection() returns a projection , not a

How to get geolocation from a UK postal code

扶醉桌前 提交于 2019-12-21 02:47:22
问题 I have a PHP script at the moment which allows users to enter a UK postcode. I was wondering if there was a way I could get their geolocation from the postcode they enter. (Through Google's API or something?) I have tried http://code.google.com/apis/maps/documentation/geocoding/index.html but it requires a full address, whereas I only have a postcode. Help would be appreciated, thanks :) Peter 回答1: You could check out the Yahoo PlaceFinder API Heres an example URL http://where.yahooapis.com

Google Maps v3 Create routes between two points

三世轮回 提交于 2019-12-21 01:50:53
问题 I'm using the Google Maps API to develop a web application. I am trying to create a route between two points but for some reason I haven't figured out how create it. Below is my code, please let me know if there is something I am missing. Thank you. <script> var Center=new google.maps.LatLng(18.210885,-67.140884); var directionsDisplay; var directionsService = new google.maps.DirectionsService(); var map; function initialize() { directionsDisplay = new google.maps.DirectionsRenderer(); var

'Uncaught InvalidValueError' (: setCenter: not a LatLng or LatLngLiteral object)

南笙酒味 提交于 2019-12-20 21:57:43
问题 I'm starting to know PHP and JavaScript, mixing them in HTML and using Google Maps API (version 3). I figured how to 'put' various markers but the console will throw me an error: " Uncaught InvalidValueError: setCenter: not a LatLng or LatLngLiteral object ". I think it's because the var created in the loop is not exactly the object needed but instead a string, though this confuses me, I don't know if I'm right. This is my code: (By the way, the array I'm looping is an array with an array

Get address coordinates of Google Maps API by ajax() request

自闭症网瘾萝莉.ら 提交于 2019-12-20 21:56:32
问题 I'm trying to get lng and lat coordinates of the Google Maps API by the next example http://jsbin.com/inepo3/7/edit. I expect a 'success' popup, but it keeps showing the 'Error' popup. The google maps-request gives the correct json feedback (checked by firebug). <script type="text/javascript"> $().ready(function() { $.fn.getCoordinates=function(address){ $.ajax( { type : "GET", url: "http://maps.google.com/maps/api/geocode/json", dataType: "jsonp", data: { address: address, sensor: "true" },