Search code examples
javascriptgoogle-mapsgisgeographycartography

How to draw graphics on Google Map from Web Mercator Meters/Feet


I used to draw graphics on Google Map from decimal degrees (latlng), but recently I found a server that only provide Web Mercator meters (or feet perhaps). Then I found the function to draw decimal degrees does not apply to Web Mercator meters:

        //this works well
        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(40, -100),
            map: MAP
        });
        //this does not work
        var marker = new google.maps.Marker({
            position: new google.maps.LatLng(-9076798, 3012626),
            map: MAP
        });

Please help me solve this problem. I know there is no simple equation to convert decimal degrees to state plane meters/feet. Thanks.


Solution

  • It is solved, just include ESRI API and use their functions: https://developers.arcgis.com/javascript/jsapi/esri.geometry.webmercatorutils-amd.html