Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is how it's done in code. You need to declare as GeometryService that uses some an external webservice. This one is the sampleservice from Esri that might be out of order when you read this answer because there has been an upgrade. Best is to use your own arcgis service, for now I used this one:</p> <pre><code>http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer </code></pre> <p>Put in to Declarations</p> <pre><code>&lt;fx:Declarations&gt; &lt;esri:GeometryService id="geometryService" concurrency="last" fault="geometryService_faultHandler(event)" projectComplete="projectCompleteHandler(event)" showBusyCursor="true" url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer"/&gt; &lt;/fx:Declarations&gt; </code></pre> <p>Then create the WebMercatorExtent, create a SpatialReference you want your Geometry converted to and project it. The web service will provide the answer...</p> <pre><code> var wmExtent:WebMercatorExtent = new WebMercatorExtent( _mapItemBounds.getSouthWest().lng(), _mapItemBounds.getSouthWest().lat(), _mapItemBounds.getNorthEast().lng(), _mapItemBounds.getNorthEast().lat()); var outSR:SpatialReference = new SpatialReference(28992); const projectParameters:ProjectParameters = new ProjectParameters; projectParameters.geometries = [ wmExtent]; projectParameters.outSpatialReference = outSR; geometryService.project(projectParameters); </code></pre> <p>...in the function</p> <pre><code> protected function projectCompleteHandler(event:GeometryServiceEvent):void { try { // Note: As of version 2.0, GeometryService returns geometries (instead of graphics) var extent:Extent = (event.result as Array)[0] as Extent; map.extent = extent; } catch (error:Error) { Alert.show(error.toString()); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload