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;
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
add a comment |
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
add a comment |
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
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
google-maps google-maps-api-3
edited Mar 28 at 6:26
Niranjan
asked Mar 28 at 6:19
NiranjanNiranjan
173 bronze badges
173 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
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>
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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>
add a comment |
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
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>
add a comment |
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
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>
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
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>
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
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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