Custom icon image on google map polylineGoogle Maps API v3: How to remove all markers?How to disable mouse scroll wheel scaling with Google Maps APIGoogle Maps JS API v3 - Simple Multiple Marker ExampleCan't click point from KML if inside PolygonGoogle Maps: clickable polyline iconGoogle Maps V3 icon at the end of PolyLineDisplay custom image marker icons by type in Google Maps.Use to add retina images using Google-Maps-for-Rails?How to use custom icon for polyline?Embed a Google Map with approximation in my site

Why did Tony's Arc Reactor do this?

Why is Western European music harmonically driven?

Can taking my 1-week-old on a 6-7 hours journey in the car lead to medical complications?

Is there some sort of French saying for "a person's signature move"?

Bacteria vats to generate edible biomass, require intermediary species?

Why can't some airports handle heavy aircraft while others do it easily (same runway length)?

How can electricity be positive when electrons are negative?

Why are some hotels asking you to book through Booking.com instead of matching the price at the front desk?

How to run NPCs with complicated mechanics?

How do you say "to hell with everything" in French?

How can I hint that my character isn't real?

Infinitely many primes

What makes an ending "happy"?

Template default argument loses its reference type

Project Euler problem #112

What is the purpose of the rotating plate in front of the lock?

Two men on a road

Can you pop microwave popcorn on a stove?

Do you need to burn fuel between gravity assists?

Word for something that used to be popular but not anymore

Entering the US with dual citizenship but US passport is long expired?

When was "Cable Select" introduced for IDE devices?

Why do the Brexit opposition parties not want a new election?

The Green Glass Door, Revisited



Custom icon image on google map polyline


Google Maps API v3: How to remove all markers?How to disable mouse scroll wheel scaling with Google Maps APIGoogle Maps JS API v3 - Simple Multiple Marker ExampleCan't click point from KML if inside PolygonGoogle Maps: clickable polyline iconGoogle Maps V3 icon at the end of PolyLineDisplay custom image marker icons by type in Google Maps.Use to add retina images using Google-Maps-for-Rails?How to use custom icon for polyline?Embed a Google Map with approximation in my site






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-2















Need to add Custom icon image on google map poly line, i tried using to add custom icon like marker it's not working.
This is the code i have tried but not working.



var lineSymbol = 
anchor: new google.maps.Point(0, 32),
origin: new google.maps.Point(0, 0),
scaledSize: new google.maps.Size(32, 32),
size: new google.maps.Size(64, 64),
url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
;
var Line = new google.maps.Polyline(
path: path,
geodesic: true,
strokeColor: "#35495e",
strokeOpacity: 0.8,
strokeWeight: 4,
icons: [
icon: lineSymbol,
offset: '100%'
],
);









share|improve this question
































    -2















    Need to add Custom icon image on google map poly line, i tried using to add custom icon like marker it's not working.
    This is the code i have tried but not working.



    var lineSymbol = 
    anchor: new google.maps.Point(0, 32),
    origin: new google.maps.Point(0, 0),
    scaledSize: new google.maps.Size(32, 32),
    size: new google.maps.Size(64, 64),
    url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
    ;
    var Line = new google.maps.Polyline(
    path: path,
    geodesic: true,
    strokeColor: "#35495e",
    strokeOpacity: 0.8,
    strokeWeight: 4,
    icons: [
    icon: lineSymbol,
    offset: '100%'
    ],
    );









    share|improve this question




























      -2












      -2








      -2








      Need to add Custom icon image on google map poly line, i tried using to add custom icon like marker it's not working.
      This is the code i have tried but not working.



      var lineSymbol = 
      anchor: new google.maps.Point(0, 32),
      origin: new google.maps.Point(0, 0),
      scaledSize: new google.maps.Size(32, 32),
      size: new google.maps.Size(64, 64),
      url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
      ;
      var Line = new google.maps.Polyline(
      path: path,
      geodesic: true,
      strokeColor: "#35495e",
      strokeOpacity: 0.8,
      strokeWeight: 4,
      icons: [
      icon: lineSymbol,
      offset: '100%'
      ],
      );









      share|improve this question
















      Need to add Custom icon image on google map poly line, i tried using to add custom icon like marker it's not working.
      This is the code i have tried but not working.



      var lineSymbol = 
      anchor: new google.maps.Point(0, 32),
      origin: new google.maps.Point(0, 0),
      scaledSize: new google.maps.Size(32, 32),
      size: new google.maps.Size(64, 64),
      url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
      ;
      var Line = new google.maps.Polyline(
      path: path,
      geodesic: true,
      strokeColor: "#35495e",
      strokeOpacity: 0.8,
      strokeWeight: 4,
      icons: [
      icon: lineSymbol,
      offset: '100%'
      ],
      );






      google-maps google-maps-api-3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 6:26







      Niranjan

















      asked Mar 28 at 6:19









      NiranjanNiranjan

      173 bronze badges




      173 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1
















          That method only works with SVG Symbols. In this case, just use a google.maps.Marker at the end of the path.



          var lineSymbol = new google.maps.Marker(
          icon:
          anchor: new google.maps.Point(0, 32),
          origin: new google.maps.Point(0, 0),
          scaledSize: new google.maps.Size(32, 32),
          size: new google.maps.Size(64, 64),
          url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
          ,
          position: path[path.length-1],
          map: map
          );


          proof of concept fiddle



          image of resulting map



          code snippet:






          function initMap() 
          var map = new google.maps.Map(document.getElementById('map'),
          zoom: 3,
          center:
          lat: 0,
          lng: -180
          ,
          mapTypeId: 'terrain'
          );

          var path = [lat: 37.772,lng: -122.214,
          lat: 21.291,lng: -157.821,
          lat: -18.142,lng: 178.431,
          lat: -27.467,lng: 153.027
          ];
          var lineSymbol = new google.maps.Marker(
          icon:
          anchor: new google.maps.Point(16, 16), // center icon on end of polyline
          origin: new google.maps.Point(0, 0),
          scaledSize: new google.maps.Size(32, 32),
          size: new google.maps.Size(64, 64),
          url: "https://i.stack.imgur.com/7Fzjf.png"
          ,
          position: path[path.length - 1],
          map: map
          );
          var Line = new google.maps.Polyline(
          path: path,
          geodesic: true,
          strokeColor: "#35495e",
          strokeOpacity: 0.8,
          strokeWeight: 4,
          icons: [
          icon: lineSymbol,
          offset: '100%'
          ],
          );
          Line.setMap(map);
          var bounds = new google.maps.LatLngBounds();
          for (var i = 0; i < Line.getPath().getLength(); i++)
          bounds.extend(Line.getPath().getAt(i));

          map.fitBounds(bounds);

          html,
          body,
          #map
          height: 100%;
          margin: 0;
          padding: 0;

          <div id="map"></div>
          <!-- Replace the value of the key parameter with your own API key. -->
          <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>








          share|improve this answer


























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );














            draft saved

            draft discarded
















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391245%2fcustom-icon-image-on-google-map-polyline%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1
















            That method only works with SVG Symbols. In this case, just use a google.maps.Marker at the end of the path.



            var lineSymbol = new google.maps.Marker(
            icon:
            anchor: new google.maps.Point(0, 32),
            origin: new google.maps.Point(0, 0),
            scaledSize: new google.maps.Size(32, 32),
            size: new google.maps.Size(64, 64),
            url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
            ,
            position: path[path.length-1],
            map: map
            );


            proof of concept fiddle



            image of resulting map



            code snippet:






            function initMap() 
            var map = new google.maps.Map(document.getElementById('map'),
            zoom: 3,
            center:
            lat: 0,
            lng: -180
            ,
            mapTypeId: 'terrain'
            );

            var path = [lat: 37.772,lng: -122.214,
            lat: 21.291,lng: -157.821,
            lat: -18.142,lng: 178.431,
            lat: -27.467,lng: 153.027
            ];
            var lineSymbol = new google.maps.Marker(
            icon:
            anchor: new google.maps.Point(16, 16), // center icon on end of polyline
            origin: new google.maps.Point(0, 0),
            scaledSize: new google.maps.Size(32, 32),
            size: new google.maps.Size(64, 64),
            url: "https://i.stack.imgur.com/7Fzjf.png"
            ,
            position: path[path.length - 1],
            map: map
            );
            var Line = new google.maps.Polyline(
            path: path,
            geodesic: true,
            strokeColor: "#35495e",
            strokeOpacity: 0.8,
            strokeWeight: 4,
            icons: [
            icon: lineSymbol,
            offset: '100%'
            ],
            );
            Line.setMap(map);
            var bounds = new google.maps.LatLngBounds();
            for (var i = 0; i < Line.getPath().getLength(); i++)
            bounds.extend(Line.getPath().getAt(i));

            map.fitBounds(bounds);

            html,
            body,
            #map
            height: 100%;
            margin: 0;
            padding: 0;

            <div id="map"></div>
            <!-- Replace the value of the key parameter with your own API key. -->
            <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>








            share|improve this answer































              1
















              That method only works with SVG Symbols. In this case, just use a google.maps.Marker at the end of the path.



              var lineSymbol = new google.maps.Marker(
              icon:
              anchor: new google.maps.Point(0, 32),
              origin: new google.maps.Point(0, 0),
              scaledSize: new google.maps.Size(32, 32),
              size: new google.maps.Size(64, 64),
              url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
              ,
              position: path[path.length-1],
              map: map
              );


              proof of concept fiddle



              image of resulting map



              code snippet:






              function initMap() 
              var map = new google.maps.Map(document.getElementById('map'),
              zoom: 3,
              center:
              lat: 0,
              lng: -180
              ,
              mapTypeId: 'terrain'
              );

              var path = [lat: 37.772,lng: -122.214,
              lat: 21.291,lng: -157.821,
              lat: -18.142,lng: 178.431,
              lat: -27.467,lng: 153.027
              ];
              var lineSymbol = new google.maps.Marker(
              icon:
              anchor: new google.maps.Point(16, 16), // center icon on end of polyline
              origin: new google.maps.Point(0, 0),
              scaledSize: new google.maps.Size(32, 32),
              size: new google.maps.Size(64, 64),
              url: "https://i.stack.imgur.com/7Fzjf.png"
              ,
              position: path[path.length - 1],
              map: map
              );
              var Line = new google.maps.Polyline(
              path: path,
              geodesic: true,
              strokeColor: "#35495e",
              strokeOpacity: 0.8,
              strokeWeight: 4,
              icons: [
              icon: lineSymbol,
              offset: '100%'
              ],
              );
              Line.setMap(map);
              var bounds = new google.maps.LatLngBounds();
              for (var i = 0; i < Line.getPath().getLength(); i++)
              bounds.extend(Line.getPath().getAt(i));

              map.fitBounds(bounds);

              html,
              body,
              #map
              height: 100%;
              margin: 0;
              padding: 0;

              <div id="map"></div>
              <!-- Replace the value of the key parameter with your own API key. -->
              <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>








              share|improve this answer





























                1














                1










                1









                That method only works with SVG Symbols. In this case, just use a google.maps.Marker at the end of the path.



                var lineSymbol = new google.maps.Marker(
                icon:
                anchor: new google.maps.Point(0, 32),
                origin: new google.maps.Point(0, 0),
                scaledSize: new google.maps.Size(32, 32),
                size: new google.maps.Size(64, 64),
                url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
                ,
                position: path[path.length-1],
                map: map
                );


                proof of concept fiddle



                image of resulting map



                code snippet:






                function initMap() 
                var map = new google.maps.Map(document.getElementById('map'),
                zoom: 3,
                center:
                lat: 0,
                lng: -180
                ,
                mapTypeId: 'terrain'
                );

                var path = [lat: 37.772,lng: -122.214,
                lat: 21.291,lng: -157.821,
                lat: -18.142,lng: 178.431,
                lat: -27.467,lng: 153.027
                ];
                var lineSymbol = new google.maps.Marker(
                icon:
                anchor: new google.maps.Point(16, 16), // center icon on end of polyline
                origin: new google.maps.Point(0, 0),
                scaledSize: new google.maps.Size(32, 32),
                size: new google.maps.Size(64, 64),
                url: "https://i.stack.imgur.com/7Fzjf.png"
                ,
                position: path[path.length - 1],
                map: map
                );
                var Line = new google.maps.Polyline(
                path: path,
                geodesic: true,
                strokeColor: "#35495e",
                strokeOpacity: 0.8,
                strokeWeight: 4,
                icons: [
                icon: lineSymbol,
                offset: '100%'
                ],
                );
                Line.setMap(map);
                var bounds = new google.maps.LatLngBounds();
                for (var i = 0; i < Line.getPath().getLength(); i++)
                bounds.extend(Line.getPath().getAt(i));

                map.fitBounds(bounds);

                html,
                body,
                #map
                height: 100%;
                margin: 0;
                padding: 0;

                <div id="map"></div>
                <!-- Replace the value of the key parameter with your own API key. -->
                <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>








                share|improve this answer















                That method only works with SVG Symbols. In this case, just use a google.maps.Marker at the end of the path.



                var lineSymbol = new google.maps.Marker(
                icon:
                anchor: new google.maps.Point(0, 32),
                origin: new google.maps.Point(0, 0),
                scaledSize: new google.maps.Size(32, 32),
                size: new google.maps.Size(64, 64),
                url: "http://www.developerdrive.com/wp-content/uploads/2013/08/ddrive.png"
                ,
                position: path[path.length-1],
                map: map
                );


                proof of concept fiddle



                image of resulting map



                code snippet:






                function initMap() 
                var map = new google.maps.Map(document.getElementById('map'),
                zoom: 3,
                center:
                lat: 0,
                lng: -180
                ,
                mapTypeId: 'terrain'
                );

                var path = [lat: 37.772,lng: -122.214,
                lat: 21.291,lng: -157.821,
                lat: -18.142,lng: 178.431,
                lat: -27.467,lng: 153.027
                ];
                var lineSymbol = new google.maps.Marker(
                icon:
                anchor: new google.maps.Point(16, 16), // center icon on end of polyline
                origin: new google.maps.Point(0, 0),
                scaledSize: new google.maps.Size(32, 32),
                size: new google.maps.Size(64, 64),
                url: "https://i.stack.imgur.com/7Fzjf.png"
                ,
                position: path[path.length - 1],
                map: map
                );
                var Line = new google.maps.Polyline(
                path: path,
                geodesic: true,
                strokeColor: "#35495e",
                strokeOpacity: 0.8,
                strokeWeight: 4,
                icons: [
                icon: lineSymbol,
                offset: '100%'
                ],
                );
                Line.setMap(map);
                var bounds = new google.maps.LatLngBounds();
                for (var i = 0; i < Line.getPath().getLength(); i++)
                bounds.extend(Line.getPath().getAt(i));

                map.fitBounds(bounds);

                html,
                body,
                #map
                height: 100%;
                margin: 0;
                padding: 0;

                <div id="map"></div>
                <!-- Replace the value of the key parameter with your own API key. -->
                <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>








                function initMap() 
                var map = new google.maps.Map(document.getElementById('map'),
                zoom: 3,
                center:
                lat: 0,
                lng: -180
                ,
                mapTypeId: 'terrain'
                );

                var path = [lat: 37.772,lng: -122.214,
                lat: 21.291,lng: -157.821,
                lat: -18.142,lng: 178.431,
                lat: -27.467,lng: 153.027
                ];
                var lineSymbol = new google.maps.Marker(
                icon:
                anchor: new google.maps.Point(16, 16), // center icon on end of polyline
                origin: new google.maps.Point(0, 0),
                scaledSize: new google.maps.Size(32, 32),
                size: new google.maps.Size(64, 64),
                url: "https://i.stack.imgur.com/7Fzjf.png"
                ,
                position: path[path.length - 1],
                map: map
                );
                var Line = new google.maps.Polyline(
                path: path,
                geodesic: true,
                strokeColor: "#35495e",
                strokeOpacity: 0.8,
                strokeWeight: 4,
                icons: [
                icon: lineSymbol,
                offset: '100%'
                ],
                );
                Line.setMap(map);
                var bounds = new google.maps.LatLngBounds();
                for (var i = 0; i < Line.getPath().getLength(); i++)
                bounds.extend(Line.getPath().getAt(i));

                map.fitBounds(bounds);

                html,
                body,
                #map
                height: 100%;
                margin: 0;
                padding: 0;

                <div id="map"></div>
                <!-- Replace the value of the key parameter with your own API key. -->
                <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>





                function initMap() 
                var map = new google.maps.Map(document.getElementById('map'),
                zoom: 3,
                center:
                lat: 0,
                lng: -180
                ,
                mapTypeId: 'terrain'
                );

                var path = [lat: 37.772,lng: -122.214,
                lat: 21.291,lng: -157.821,
                lat: -18.142,lng: 178.431,
                lat: -27.467,lng: 153.027
                ];
                var lineSymbol = new google.maps.Marker(
                icon:
                anchor: new google.maps.Point(16, 16), // center icon on end of polyline
                origin: new google.maps.Point(0, 0),
                scaledSize: new google.maps.Size(32, 32),
                size: new google.maps.Size(64, 64),
                url: "https://i.stack.imgur.com/7Fzjf.png"
                ,
                position: path[path.length - 1],
                map: map
                );
                var Line = new google.maps.Polyline(
                path: path,
                geodesic: true,
                strokeColor: "#35495e",
                strokeOpacity: 0.8,
                strokeWeight: 4,
                icons: [
                icon: lineSymbol,
                offset: '100%'
                ],
                );
                Line.setMap(map);
                var bounds = new google.maps.LatLngBounds();
                for (var i = 0; i < Line.getPath().getLength(); i++)
                bounds.extend(Line.getPath().getAt(i));

                map.fitBounds(bounds);

                html,
                body,
                #map
                height: 100%;
                margin: 0;
                padding: 0;

                <div id="map"></div>
                <!-- Replace the value of the key parameter with your own API key. -->
                <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initMap"></script>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 29 at 13:31

























                answered Mar 28 at 12:17









                geocodezipgeocodezip

                133k12 gold badges158 silver badges189 bronze badges




                133k12 gold badges158 silver badges189 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.




















                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55391245%2fcustom-icon-image-on-google-map-polyline%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현