向西/向东|来自Google API的GPS坐标的北/南 [英] Get West/East | North/South from GPS coordinates from Google API

查看:98
本文介绍了向西/向东|来自Google API的GPS坐标的北/南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Lat&长.我怎样才能获得东西方的便利?来自GPS的北/南?

I have Lat & Long. How can i get West/East | North/South from GPS?

附加的屏幕截图:屏幕截图

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

<script type="text/javascript" src="/design/js/jquery-autocomplete/jquery.autocomplete_geomod.js"></script>

<script type="text/javascript" src="/design/js/jquery-autocomplete/geo_autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="/design/js/jquery-autocomplete/jquery.autocomplete.css" />

<script type="text/javascript">
$().ready(function() {

    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    // use all the autocomplete options as documented at http://docs.jquery.com/Plugins/Autocomplete
    /* additional geo_autocomplete options:
        mapkey : 'ABQ...' (required for Static Maps thumbnails, obtain a key for your site from http://code.google.com/apis/maps/signup.html)
        mapwidth : 100
        mapheight : 100
        maptype : 'terrain' (see http://code.google.com/apis/maps/documentation/staticmaps/#MapTypes)
        mapsensor : true or false
    */
    $('#location').geo_autocomplete(new google.maps.Geocoder, {
        mapkey: 'ABQIAAAAbnvDoAoYOSW2iqoXiGTpYBTIx7cuHpcaq3fYV4NM0BaZl8OxDxS9pQpgJkMv0RxjVl6cDGhDNERjaQ', 
        selectFirst: false,
        minChars: 3,
        cacheLength: 50,
        width: 300,
        scroll: true,
        scrollHeight: 330
    }).result(function(_event, _data) {

    var coords = new google.maps.LatLng(
                        _data.geometry.location.lat(),
                        _data.geometry.location.lng()
                    );

        $('#lat').val (_data.geometry.location.lat())
        $('#lng').val (_data.geometry.location.lng())


        console.log (coords.lat () + '/' + coords.lng ());

        if (_data) map.fitBounds(_data.geometry.viewport);
    });

});
</script>
<style>
.ac_results li img {
    float: left;
    margin-right: 5px;
}
</style>

<h3><a href="http://code.google.com/p/geo-autocomplete">jQuery geo-autocomplete Plugin</a> Demo</h3>

<div>Location: <input type="text" id="location" /> (autocomplete)</div>
<br/>
<div id="coords">Lat: 
    <input id="lat" name="lat" />
    Lng: 
    <input id="lng" name="lng" />
</div>
<br/>

推荐答案

东西方:如果经度< 0,然后西,否则东
南北:如果纬度< 0,然后向南,向北

East/West: if longitude < 0 then West, else East
North/South: if latitude < 0 then South else North

说明:
0子午线(通过伦敦/格林威治)是东西方之间的界限.
赤道是南北之间的界限.

Explanation:
The 0-Meridian (through London/Greenwich) is the limit between west and east.
The Aequator is the limit between south and north.

在Google中,坐标以十进制度表示,其中负号定义E/W或N/S

in Google, coordinates are represented in decimal degrees, where the negative sign, defines E/W or N/S

这篇关于向西/向东|来自Google API的GPS坐标的北/南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆