arcgis js PictureMarkerSymbol
时间: 2023-10-20 20:05:48 浏览: 35
PictureMarkerSymbol is a class in the ArcGIS API for JavaScript that represents a symbol for displaying an image as a marker on a map. It allows the developer to customize the appearance of the image by setting properties such as width, height, angle, and offset.
To use PictureMarkerSymbol, you need to:
1. Import the module:
```
import PictureMarkerSymbol from '@arcgis/core/symbols/PictureMarkerSymbol';
```
2. Create a new instance of the symbol:
```
const symbol = new PictureMarkerSymbol({
url: 'path/to/image',
width: 32,
height: 32,
angle: 0,
xoffset: 0,
yoffset: 0
});
```
3. Use the symbol in a graphic:
```
const graphic = new Graphic({
geometry: point,
symbol: symbol
});
```
In the example above, we create a new PictureMarkerSymbol instance with an image of size 32x32 pixels, and no rotation or offset. We then use this symbol to create a new Graphic object that we can add to a MapView or SceneView.
Note that the url property can be a relative or absolute path to the image file, or a data URI. Other properties, such as angle and offset, allow you to rotate or shift the image relative to its position on the map.