簡體   English   中英

Instagram圖片到你周圍1公里半徑的谷歌地圖

[英]Instagram pictures to Google Maps in a radius of 1km around you

我想知道是否可以將Instagram照片用於使用API​​的Google地圖。 到目前為止,我已經使谷歌地圖工作,它顯示了我當前的位置,以及我周圍1公里的半徑。

我想要做的就是在我周圍展示一定數量的Instagram照片,由每個人拍攝。

但到目前為止,我不知道在哪里或如何開始,如果它甚至可能。

我的谷歌地圖的代碼是:

    </script>
        <script type="text/javascript">
        var map;
        var service;
        var marker;
        var pos;
        var infowindow;

        function initialize() {

            var mapOptions = {
                zoom: 14
            };

            map =   new google.maps.Map(document.getElementById('map-canvas'),
                    mapOptions);

            //HTML5 geolocation
            if (navigator.geolocation) {
                navigator.geolocation.getCurrentPosition(function (position) {
                    pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);


                    infowindow = new google.maps.InfoWindow({
                        map: map,
                        position: pos,
                        content: 'This is your current position!'
                    });

                        var circle = new google.maps.Circle({
                            map: map,
                            position: pos,
                            radius: 1000,    // 1km in metres
                            fillColor: '#6D86D1'
                        });
                        circle.bindTo('center', infowindow, 'position');

                    map.setCenter(pos);

                    infowindow = new google.maps.InfoWindow();
                    var service = new google.maps.places.PlacesService(map);
                    service.nearbySearch(request, callback);

                },

                    function () {
                        handleNoGeolocation(true);
                    });
            } else {
                handleNoGeolocation(false);
            }

            function callback(results, status) {
                if (status == google.maps.places.PlacesServiceStatus.OK) {
                    for (var i = 0; i < results.length; i++) {
                        createMarker(results[i]);
                    }
                }
            }

            function createMarker(place) {
                var placeLoc = place.geometry.location;
                var marker = new google.maps.Marker({
                    map: map,
                    position: place.geometry.location
                });

                google.maps.event.addListener(marker, 'click', function () {
                    infowindow.setContent(place.name);
                    infowindow.open(map, this);
                });

            }
        }
        google.maps.event.addDomListener(window, 'load', initialize);


    </script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>

您必須使用媒體/搜索API來獲取某個位置( lat/lng )和distance周圍的照片:

https://api.instagram.com/v1/media/search?lat=48.858844&lng=2.294351&distance=1000&access_token=ACCESS-TOKEN

以下是在Google地圖上獲取任意半徑范圍內的Instagram照片的實現: http//www.gramfeed.com/instagram/map

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM