Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7993741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:56:32+00:00 2026-06-04T13:56:32+00:00

I am using Google’s Javascript APi v.3.0 to develop a web app. I want

  • 0

I am using Google’s Javascript APi v.3.0 to develop a web app. I want to be able to display custom markers, but they don’t show up when I try to add them. I’ve written a helper function in Javascript to display a custom marker:

function addCustomMarker(iconFile,iconTitle,lat,lng){
   var loc = new google.maps.LatLng(lat,lng);
   var marker = new google.maps.Marker({
      position:loc,
      icon:iconFile,
      title: iconTitle,
      zIndex:2
   });
   marker.setMap(map);//Where map is a google.maps.Map already defined
}

I’m currently testing locally and my file structure sort of looks like:

  • /Maps Application
    • map.htm
    • /Images
      • markerImage.png

Elsewhere in the html file, I then call the javascript function like:

addCustomMarker('Images/markerImage.png', 'Custom Marker', 20, 50);

However, this does not work. No marker is displayed. If I comment out the “icon: markerIcon,” line, then the default marker is displayed, which tells me that it can’t find the image file.

Is there a way to reference marker images from a relative path like I am trying to do? I’ve tried ‘./Images/markerImage.png’ and ‘/Images/markerImage.png’ as well, and neither work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:56:35+00:00Added an answer on June 4, 2026 at 1:56 pm

    Yes, I also think relative paths work. I tried it locally and it works fine. I believe icon: just places the value into a src of an img tag, or something of the sort.

    Here’s my example:

    var marker = new google.maps.Marker({map: map, 
      position: new google.maps.LatLng(0,0), 
      icon: "icons/ride_red.png"});
    

    icons is a folder in the same folder where the JavaScript/HTML file is.

    Are you sure you have the capitalization correct? What if you tried “hardcoding” the icon option, that is:

    icon: 'Images/markerImage.png',
    

    Now here’s a silly question: have you also tried opening that markerImage.png in your browser?

    Beside local pages, here’s a page that has relative icon paths. You check the “Metro SP Stations” checkbox to display the icons. If you look at the source,

         estacao = new google.maps.Marker({
            map: map,
            position: toLatLng(estacao_data.posn[0], estacao_data.posn[1]),
            icon: 'metrosp/' + estacao_data.icon[0] + '.png',
            title: estacao_data.name,
            visible: false
          });
    

    Then you can navigate to the metrosp folder and see the images are all there:

    https://files.nyu.edu/hc742/public/googlemaps/metrosp/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Google map API to display map in simple javascript popup. While popup
I'm using Google App Engine python. I want to know what browser the user
I using google translate to translate the entire of my site. but i want
Im using Google Maps Javascript API V3, and recently the icons on my map
Using Google App Engine (python SDK), I created a custom JSONProperty() as a subclass
I'm using Google App Engine in Python using Google's webapp framework. I want to
When using Google Chrome, I want to debug some JavaScript code. How can I
I am using Google Maps V3 API to display my map. Problem: How can
Currently using Google Analytics as a supplement to our paid tracking software, but neither
When using Google app engine is there any benefit to use a CDN if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.