Search Widget - Changing the Default Marker

1154
8
Jump to solution
06-13-2019 08:01 AM
CraigPrisland2
New Contributor III

Hello,

I am currently using WAB Dev 2.12 and am looking to change the default marker from a black dot to hollow.  I was able to partially do this.  On line 374, I changed the SimpleMarkerSymbol from 'Style_SOLID' to 'Style_NULL.  This did make my marker a hollow fill but I still have a black circle (with a hollow fill).  I've been playing around with this section for quite a while now and have been unable to successfully hollowing out the outline as well.  Any help would be greatly appreciated.

Thanks,

Craig

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

In that case the just do this:

convertedSource.highlightSymbol = new SimpleMarkerSymbol(
  SimpleMarkerSymbol.STYLE_CIRCLE, 10, 
  new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255]),2),
  new Color([0, 0, 0, 0])
);‍‍‍‍‍‍

Notice the addition of one extra 0 in the last Color class this sets the makers fill to black with an alpha of 0.

View solution in original post

0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus

Craig,

   So what are you really wanting? You said "default marker from a black dot to hollow". This to me would be a point with a color set to 0 opacity and an outline. Is that what you are after?

0 Kudos
CraigPrisland2
New Contributor III

Robert,

Sorry for the confusion.  Yes, this is what I am looking to accomplish.

Thanks,

Craig

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

In that case the just do this:

convertedSource.highlightSymbol = new SimpleMarkerSymbol(
  SimpleMarkerSymbol.STYLE_CIRCLE, 10, 
  new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255]),2),
  new Color([0, 0, 0, 0])
);‍‍‍‍‍‍

Notice the addition of one extra 0 in the last Color class this sets the makers fill to black with an alpha of 0.

0 Kudos
HelenZhou
Occasional Contributor II

Hello Robert,

I have some code to add my own symbol when an address is found. So I would like to make the default black symbol be transparent.

I am using WAB 2.16. When I run debugging tool in the widget.js for search widget, I don't see the debugging stopped at those lines which the "convertedSource.highlightSymbol" is assigned (convertedSource.highlightSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE,) at line 383 and line 401. The debugging doesn't stop at if statement ( if(sourceLayerInfo) ) at line 381. It looks like the small black dot is added at another location. Do you know where is it? thanks.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Helen,

   You will only hit those lines if you specified a search layer. If you are only using the locator service then those lines will not be hit.

0 Kudos
HelenZhou
Occasional Contributor II

Thank you, Robert. Do you know where to customize the symbol after an address is located with a geocoding service in the search widget?

Helen

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I have never tried that but I assume that you need to define a highlightSymbol on the locator source. I don't believe that it has one specified in the code so it just uses the default of the search dijit from the JS API.

0 Kudos
CraigPrisland2
New Contributor III

Thanks again for all your assistance Robert!

0 Kudos