Select to view content in your preferred language

Dynamic Label Generating

406
1
02-14-2019 02:29 PM
AnudeepGorantla
New Contributor

Is there a way we can do dynamic labeling. For example I draw a buffer and there are 10 parcels inside the buffer so can I label them as from 1 - 10. 

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Anudeep,

   There is no widget already out that for this but you could develop this. 

  1. Add a DrawBox dijit from the jimu library to your widget for drawing the point.
  2. Buffer that point using a Geometry service or the GeometryEngine.
  3. Add that buffer graphic to the map and then use the geometry as  the query.geometry in a QueryTask.
  4. Get the query task results from the layer you are querying and get the polygons.
  5. Send the polygons to the geometry service using labelpoints method to get the point that is inside the polygon to use as the labeling point
  6. Add a graphics layer (GL) to the map and then add the points from the labelpoints to the GL with a TextSymbol as its symbol.

Here is a sample that you can use as a starting point for the JS API code portion:

Geometry Service - Points for labeling | ArcGIS API for JavaScript 3.27 

0 Kudos