0
votes

I used "icon simple object" codes on this page: 1) https://developers.google.com/maps/documentation/javascript/examples/icon-simple

Object Coordinates : 38.481001,26.582399

When I checked object location on Google Map (this page): 2) https://maps.google.com/maps?q=%2B38%C2%B0+48'+10.01%22,+26%C2%B0+58'+23.39%22&um=1&ie=UTF-8&sa=N&tab=wl

Object locations are shown difference location on 1 & 2 pages. Is there any Google Api Map V3 problem? Or What is wrong? Can you help me? Thank you.

2

2 Answers

0
votes

The Google Maps Javascript API v3 takes coordinates in decimal degrees

+38° 48' 10.01", 26° 58' 23.39"

is 38 + (48/60) + (10.01/3600), 26 + (58/60) + (23.39/3600)

38.802780555555555555555555555556, 26.973163888888888888888888888889

Which is what Google Maps shows: 38.802745,26.973233

(Not 38.481001,26.582399)

0
votes

use this script

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

google.maps.LatLng is very important for current location

How to find google.maps.LatLng for special location ? only use google map . for example https://www.google.com/maps/place/Oak+Forest+Heritage+Preserve/@41.5979032,-87.7048253,14z/data=!4m2!3m1!1s0x0000000000000000:0x6ebf1071640b2787

and set -> var latlng = new google.maps.LatLng(41.5979032, -87.7048253);
You can set zoom option

map_canvas is your div position

<script type="text/javascript">  
          function initialize() {  
            var latlng = new google.maps.LatLng(41.5979032, -87.7048253);  
            var myOptions = {  
              zoom: 15,  
              center: latlng,  
              mapTypeId: google.maps.MapTypeId.ROADMAP  
            };  

            var map = new google.maps.Map(document.getElementById("map_canvas"),  
                myOptions);  

            var marker = new google.maps.Marker({    
              position: new google.maps.LatLng(41.5979032, -87.7048253),    
              map: map    
            });  


          }  

        </script>

And set body tag onload="initialize()"

<body onload="initialize()">

Div tag set by id map_canvas

<div id="map_canvas"></div>