0

Google マップから URL を傍受するインテント フィルターがあります。私の問題は次のとおりです。短縮リンク。座標がわからない場合、リンクは役に立ちません。残念ながら、Android リンクの Google マップでは短縮されています。Web ユーザーでは、Google マップ リンクのタイプを選択できます - 短いかどうか。この場合、座標を使用する機会があります。

要するに:このようなリンクがある場合

http://maps.google.com/maps?q=45.089036,+-106.347656&num=1&t=h&vpsrc=0&ie=UTF8&z=4&iwloc=A

座標を読み取るには問題ありません。しかし、リンクが次の場合:

http://m.google.com/u/m/zIOcsV

おっと... Googleには、このリンクを解決するための内部的な方法があります。

2 番目のリンクから座標を取得する方法を見つけた人はいますか?

4

1 に答える 1

0

Google マップの地理座標を使用して、jquery モバイル アプリのこの例を使用できます。


jsfiddle-google-maps-geo-coordinates

またはここでカスタム画像を使用: jsfiddle-google-map-with-images

頭は:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<!--link rel="stylesheet" href="/Content/jquery-mobile-responsive.css" /-->
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=true&language=en"></script>
<script>
    $(document).bind("mobileinit", function () {
        $.mobile.ajaxEnabled = false;
    });

    $(Start);

    function Start() {
        $("#google_map .ui-collapsible-heading").click(function () {
            var locations = [
              ['<br/>Main Office', 31.590496, 34.561981, 4],
              ['Sensor 16<br/>User Name: 16_DE-1R', 31.590595, 34.562980, 5],
              ['Sensor 17<br/>User Name: 17_TEN-2MP', 31.590694, 34.563979, 3],
              ['Sensor 18<br/>User Name: 18_TEN-2MP', 31.590793, 34.564978, 2],
            ];

            var map = new google.maps.Map(document.getElementById('googleMap'), {
                zoom: 17,
                center: new google.maps.LatLng(31.590892, 34.561977),
                mapTypeId: google.maps.MapTypeId.ROADMAP
            });

            var infowindow = new google.maps.InfoWindow();

            var marker, i;

            for (i = 0; i < locations.length; i++) {
                marker = new google.maps.Marker({
                    position: new google.maps.LatLng(locations[i][3], locations[i][2]),
                    map: map
                });

                google.maps.event.addListener(marker, 'click', (function (marker, i) {
                    return function () {
                        infowindow.setContent(locations[i][0]);
                        infowindow.open(map, marker);
                    }
                })(marker, i));
            }
        });
    }
</script>

と本体:

<div data-role="page" class="type-interior">
<div data-role="header" data-theme="a">
    <a data-icon="back" href="#" rel="external">Back</a>
    <h1>Sensor</h1>
</div>
<div data-role="content">
    <div class="content-primary">
        <h2>Sensor: 16</h2>
            <div data-role="collapsible-set">
                <div id="google_map" data-role='collapsible' data-collapsed=true data-theme="b" data-content-theme="d">
                    <h1>Sensor Map</h1>
                    <div id="googleMap" style="width:100%; height:300px;"></div>
                </div>
            </div>    
        <ul data-role="listview" data-inset="true" data-theme="b">
            <li data-role="list-divider"></li>                
            <li><a href="#" rel="external">Configure Comm</a></li>
            <li><a href="#" rel="external">Measurements</a></li>
            <li><a href="#" rel="external">Users</a></li>
        </ul>
    </div>
    <div class="content-secondary">
        <div data-role="collapsible" data-collapsed="true" data-theme="b" data-content-theme="d">
                <h3>More Options</h3>
                <ul data-role="listview" data-theme="c" data-dividertheme="d">
                    <li data-role="list-divider">Actions</li>
                    <li><a href="/Home/UserList?back=Index" rel="external">Add User</a></li>
                    <li><a href="#" rel="external">Edit Sensor</a></li>
                    <li><a href="#" rel="external">Delete Sensor</a></li>
                </ul>
        </div>
    </div>
</div>
<div data-role="footer" data-theme="a">
    <h4>Mobile</h4>
</div>

于 2012-12-27T15:37:42.143 に答える