Select to view content in your preferred language

how to make a circle on a map and auto zoom it when the mapscale changes, how to make a circle on a map and auto zoom it when the mapscale changes

1043
2
Jump to solution
06-04-2018 01:52 AM
wangchao1
Emerging Contributor

I used AGSSimpleMarkerSymbol, but I dong know how to auto zoom it when the mapscale changes

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

Looking at the title of the post, I don't think you're talking about Reference Scale.

I think you want to place a circular polygon. You'd do this as follows:

  1. Create an AGSPoint for the center of the circle (you're already doing this).
  2. Use the AGSGeometryEngine.bufferGeometry() call to create a circle of the desired radius around the center point (note, depending on what you want to achieve you might want to use geodeticBuffer() instead).
  3. Create an AGSGraphic using the buffered geometry and an AGSSimpleFillSymbol.
  4. Add that graphic to an AGSGraphicOverlay.
  5. Ensure that graphics overlay is added to your AGSMapView's graphicsOverlays array.

You shouldn't create a new AGSGraphicsOverlay each time you create a circle. An overlay can contain many graphics. I think you're already doing steps 3, 4, and 5 but with a point graphic rather than a polygon graphic.

View solution in original post

0 Kudos
2 Replies
Nicholas-Furness
Esri Regular Contributor

Can you provide some more information please? Are you trying to represent a fixed physical area with the circle, or are you talking more about a reference scale?

Reference Scale means that the symbol is a specific screen size at a specific map scale, and as you zoom the map the symbol's screen size changes appropriately to match.

0 Kudos
Nicholas-Furness
Esri Regular Contributor

Looking at the title of the post, I don't think you're talking about Reference Scale.

I think you want to place a circular polygon. You'd do this as follows:

  1. Create an AGSPoint for the center of the circle (you're already doing this).
  2. Use the AGSGeometryEngine.bufferGeometry() call to create a circle of the desired radius around the center point (note, depending on what you want to achieve you might want to use geodeticBuffer() instead).
  3. Create an AGSGraphic using the buffered geometry and an AGSSimpleFillSymbol.
  4. Add that graphic to an AGSGraphicOverlay.
  5. Ensure that graphics overlay is added to your AGSMapView's graphicsOverlays array.

You shouldn't create a new AGSGraphicsOverlay each time you create a circle. An overlay can contain many graphics. I think you're already doing steps 3, 4, and 5 but with a point graphic rather than a polygon graphic.

0 Kudos