Select to view content in your preferred language

How to highlight or change the color of pin which are under the polygon?

2508
9
07-27-2017 05:17 AM
KamalMittal
Deactivated User

I am trying to change the CSS of the feature from feature layer through the javascript API 3.2.1 . 

Please check the attached file of pin image.

Thanks

0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Emeritus

Kamal,

   You do not work with the CSS for symbols in the JS API as they are mainly SVG graphics. You need to change the Symbol class for that graphic.

0 Kudos
KamalMittal
Deactivated User

Robert

I have updated the image of a pin . please check it again then you might be clear what i am asking for

Thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kamal,

   So are you setting the point symbol using a picturemarkersymbol?

0 Kudos
KamalMittal
Deactivated User

Robert,

No , it is the image coming from the feature layer. we are not setting anything in the javascript.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

OK now I understand. So one way to handle this is to get the pins geometry through a query and set the symbol you want to the graphic.

0 Kudos
KamalMittal
Deactivated User

I have already added the symbol for a graph and that is for filling color of the polygon. but now i want to change the CSS of pins which are under the polygon.

Here is the code

var symbol = new SimpleFillSymbol(
                      SimpleFillSymbol.STYLE_SOLID,
                      new SimpleLineSymbol(
                      SimpleLineSymbol.STYLE_SOLID,
                      new Color([r,g,b,0.9]),
                      4
                      ),new Color([r,g,b,0.5]));

var graphic = new Graphic(query, symbol);

map.graphics.add(graphic);

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Kamal,

  So not you set the symbol of the point for the FeatureLayer using a SimpleMarkerSymbol or a PictureMarkerSymbol then.

0 Kudos
KamalMittal
Deactivated User

No i am not setting any symbol for the point of feature layer. I am setting for the color filling inside the polygon. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

BUT you need to query and set the symbol for the pin that you want to change, unless you change the symbol in the map service. If you want to change it in JS then you need to assign a specific symbol to the whole FL or a specific graphic.

0 Kudos