-1

I would like to know if it's possible to add by default this block, mapped on the address found with google.maps.goecoder ?

This is my code , in a Marionette view

        var address = _this.model.get('address') + ' ' + _this.model.get('city');
        var geocoder = new google.maps.Geocoder();

        geocoder.geocode({'address': address}, function(results, status) {

            if (status === google.maps.GeocoderStatus.OK) {
                var map = new google.maps.Map(_this.ui.map[0], {
                    center: results[0].geometry.location,
                    zoomControl: true,
                    mapTypeControl: true,
                    scaleControl: true,
                    streetViewControl: true,
                    rotateControl: true
                });
                map.setCenter(results[0].geometry.location);
                map.setZoom(14);
                new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location,
                    title : results[0].formatted_address
                });
            } else {
                alert('Geocode was not successful for the following reason: ' + status);
            }

        });

This would be nice, if, when the map is showing, the default block use by the google maps app, appeared on my map. Is that possible ?

EDIT : Basically, it's the same requirement as this post. But do you know if it's included in the maps API ? I found nothing on it… and I would prefer to be sure before doin something a bit custom

Thanks in advance,

Community
  • 1
  • 1
Chilipote
  • 1,037
  • 1
  • 8
  • 30
  • It is not part of the Javascript API, but the pieces you need to create it are available. It is available in the Embed API. – geocodezip Jan 11 '16 at 22:22
  • Hey, thanks @geocodezip, what I've done, is like you said, use directly the google Maps Embed API for visioning the address. However, to set the address, I use the google maps API directly to link the input and the map. I 've created a gist here https://gist.github.com/chilipote/565263fa871b83329388 – Chilipote Jan 12 '16 at 16:02
  • Please [answer your own question](http://meta.stackoverflow.com/questions/250204/can-you-answer-your-own-questions-on-stack-overflow) – geocodezip Jan 12 '16 at 16:07
  • Done! Sorry I'm new here. Thanks again – Chilipote Jan 12 '16 at 19:58
  • FYI - it isn't my "answer" it is my "comment", yours is an answer, and you should [accept it](http://meta.stackoverflow.com/questions/5234/how-does-accepting-an-answer-work) (if someone comes along with a better answer you can always change your mind) – geocodezip Jan 12 '16 at 20:12
  • All right, updated and accepted, thanks for explanations – Chilipote Jan 13 '16 at 20:25

1 Answers1

0

According to @geocodezip comment, I usee directly the google Maps Embed API for visioning the address.

However, to set the address, I use the google maps API directly to link the input and the map. I 've created a gist here

Chilipote
  • 1,037
  • 1
  • 8
  • 30