Select to view content in your preferred language

how to display image as polygon symbol in JavaScript SDK

446
3
10-24-2024 11:40 AM
InQiDev
Emerging Contributor

I am already aware of PictureMarkerSymbol and PictureFillSymbol. But what I need is a different kind of symbol that I can use to fill a polygon. Ideally I want to be able to keep the aspect ratio. unlike PictureMarkerSymbol, I need the image moves with the polygon... does such symbol exist in JavaScript SDK?

0 Kudos
3 Replies
Sage_Wall
Esri Regular Contributor
0 Kudos
InQiDev
Emerging Contributor

Thanks but PictureFillSymbol also repeatedly fills the area. I need to keep only on image so that I just reshape the polygon to fit the image.

0 Kudos
RamaniGanason
Regular Contributor

I don't think there is straightforward way to achieve this. I would achieve this by using the following steps: 
1) Create a temp Graphic or Point Layer.
2) For every polygon, get the centroid of the polygon and add as point feature.
3) Use the PictureMarkerSymbol to symbolise the point feature.

Hope this helps.

0 Kudos