<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Draw a polygon given an ordered list of lat/lon points? in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137133#M3196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Getting close.&amp;nbsp; After the &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;addRing&lt;/SPAN&gt;&lt;SPAN&gt; call, when I spit out the contents of &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;thePolygon.toString()&lt;/SPAN&gt;&lt;SPAN&gt;, I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
(com.esri.ags.geometry::Polygon)#0
&amp;nbsp; hasM = false
&amp;nbsp; hasZ = false
&amp;nbsp; rings = (Array)#1
&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] (Array)#2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] (Array)#3
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] 40.6701
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] 73.94001
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] (Array)#4
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] 40.6724
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] 73.94012
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [2] (Array)#5
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] 40.6902
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] 74.02011
&amp;nbsp; spatialReference = (com.esri.ags::SpatialReference)#6
&amp;nbsp;&amp;nbsp;&amp;nbsp; vcsWkid = NaN
&amp;nbsp;&amp;nbsp;&amp;nbsp; wkid = 4326
&amp;nbsp;&amp;nbsp;&amp;nbsp; wkt = (null)
&amp;nbsp; type = "esriGeometryPolygon"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... The next line, though (&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/SPAN&gt;&lt;SPAN&gt;) , is breaking.&amp;nbsp; Since geographicToWebMercator returns a Geometry, I need to add an "as Polygon" on the end of it so it knows specifically that this is a Polygon geometry.&amp;nbsp; So I put that in place.&amp;nbsp; But, I'm getting an error on that line, and being as I'm calling this from JavaScript, the error message is unhelpful:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]"Error: Error calling method on NPObject.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at &amp;lt;anonymous&amp;gt;:2:17&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.InjectedScript._evaluateOn (&amp;lt;anonymous&amp;gt;:613:39)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.InjectedScript._evaluateAndWrap (&amp;lt;anonymous&amp;gt;:573:52)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.InjectedScript.evaluate (&amp;lt;anonymous&amp;gt;:492:21)"[/INDENT] &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;..Any idea what the problem might be?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Just writing code of the top of my head, I would try something like this (of course this is missing the imports):&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var thePolygon:Polygon = new Polygon(null, new SpatialReference(4326));
thePolygon.addRing(JSONUtil.decode(data.polygon));
var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 07:37:15 GMT</pubDate>
    <dc:creator>DanielMauer</dc:creator>
    <dc:date>2021-12-11T07:37:15Z</dc:date>
    <item>
      <title>Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137127#M3190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a map, the projection is Web Mercator.&amp;nbsp; My web application is going to be calling (via javascript external interface) a function which will receive an object as input like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;// JavaScript&amp;nbsp; var inputObject = {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon: [ [40.6701, 73.94001], [40.6724, 73.94012], [40.6902, 74.02011] ], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; title: "My Selected Region" }&amp;nbsp; document.getElementById("myMap").SetSelectedPolygonFunction(inputObject); &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...I've already got a graphics layer on the map ("myGraphicsLayer").&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, what I need to do is write this function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;// Flex map code&amp;nbsp; // In initialization function: // .... &amp;nbsp;&amp;nbsp; ExternalInterface.addCallback("SetSelectedPolygon", setSelectedPolygon); // ....etc&amp;nbsp;&amp;nbsp; private function setSelectedPolygon(data:Object = null):void {&amp;nbsp;&amp;nbsp;&amp;nbsp; var thePolygon:Polygon = doSomethingOrOtherTo(data.polygon); // What do I do to data.polygon to make this function work?&amp;nbsp;&amp;nbsp; var myGraphic:Graphic = new Graphic();&amp;nbsp; myGraphic.geometry = thePolygon;&amp;nbsp;&amp;nbsp; myGraphicsLayer.add(myGraphic);&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 18:54:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137127#M3190</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2014-03-19T18:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137128#M3191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Just writing code of the top of my head, I would try something like this (of course this is missing the imports):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var thePolygon:Polygon = new Polygon(null, new SpatialReference(4326));
thePolygon.addRing(JSONUtil.decode(data.polygon));
var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137128#M3191</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T07:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137129#M3192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That seems simple enough -- what exactly is the &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;new SpatialReference(4326)&lt;/SPAN&gt;&lt;SPAN&gt; about? Forgive the newbieness.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Just writing code of the top of my head, I would try something like this (of course this is missing the imports):&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var thePolygon:Polygon = new Polygon(null, new SpatialReference(4326));
thePolygon.addRing(JSONUtil.decode(data.polygon));
var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137129#M3192</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2021-12-11T07:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137130#M3193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Because those coordinates that you are getting are not web mercator, they look like WGS1984 lat Lon coordinates.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 19:22:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137130#M3193</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-03-19T19:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137131#M3194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I figured it was something along those lines.&amp;nbsp; So basically I'm defining the polygon in WGS1984 lat/lon, then using the web mercator utilities to convert it into web mercator coordinates, and then putting it on the graphics layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Because those coordinates that you are getting are not web mercator, they look like WGS1984 lat Lon coordinates.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 12:46:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137131#M3194</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2014-03-20T12:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137132#M3195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Yep, that is right.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't forget to &lt;/SPAN&gt;&lt;STRONG&gt;click the Mark as answer check&lt;/STRONG&gt;&lt;SPAN&gt; on this post and to &lt;/SPAN&gt;&lt;STRONG&gt;click the top arrow (promote)&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;Follow these steps&lt;/STRONG&gt;&lt;SPAN&gt; as shown in the below graphic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;IMG src="http://gis.calhouncounty.org/FlexViewer3.6/Answer.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 12:57:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137132#M3195</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-03-20T12:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137133#M3196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Getting close.&amp;nbsp; After the &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;addRing&lt;/SPAN&gt;&lt;SPAN&gt; call, when I spit out the contents of &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;thePolygon.toString()&lt;/SPAN&gt;&lt;SPAN&gt;, I get this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
(com.esri.ags.geometry::Polygon)#0
&amp;nbsp; hasM = false
&amp;nbsp; hasZ = false
&amp;nbsp; rings = (Array)#1
&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] (Array)#2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] (Array)#3
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] 40.6701
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] 73.94001
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] (Array)#4
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] 40.6724
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] 73.94012
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [2] (Array)#5
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [0] 40.6902
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [1] 74.02011
&amp;nbsp; spatialReference = (com.esri.ags::SpatialReference)#6
&amp;nbsp;&amp;nbsp;&amp;nbsp; vcsWkid = NaN
&amp;nbsp;&amp;nbsp;&amp;nbsp; wkid = 4326
&amp;nbsp;&amp;nbsp;&amp;nbsp; wkt = (null)
&amp;nbsp; type = "esriGeometryPolygon"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... The next line, though (&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/SPAN&gt;&lt;SPAN&gt;) , is breaking.&amp;nbsp; Since geographicToWebMercator returns a Geometry, I need to add an "as Polygon" on the end of it so it knows specifically that this is a Polygon geometry.&amp;nbsp; So I put that in place.&amp;nbsp; But, I'm getting an error on that line, and being as I'm calling this from JavaScript, the error message is unhelpful:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]"Error: Error calling method on NPObject.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at &amp;lt;anonymous&amp;gt;:2:17&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.InjectedScript._evaluateOn (&amp;lt;anonymous&amp;gt;:613:39)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.InjectedScript._evaluateAndWrap (&amp;lt;anonymous&amp;gt;:573:52)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Object.InjectedScript.evaluate (&amp;lt;anonymous&amp;gt;:492:21)"[/INDENT] &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;..Any idea what the problem might be?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Just writing code of the top of my head, I would try something like this (of course this is missing the imports):&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var thePolygon:Polygon = new Polygon(null, new SpatialReference(4326));
thePolygon.addRing(JSONUtil.decode(data.polygon));
var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137133#M3196</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2021-12-11T07:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137134#M3197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Well, not much to go one there... So you do have the import for WebMercatorUtil right?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 16:12:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137134#M3197</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-03-20T16:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137135#M3198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I definitely have the import.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So... I stuck it in a try/catch block to figure out what the real error is.&amp;nbsp; Type coercion failed.&amp;nbsp; So, even though &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;thePolygon&lt;/SPAN&gt;&lt;SPAN&gt; is in fact a &lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;"&gt;Polygon&lt;/SPAN&gt;&lt;SPAN&gt;, the following is throwing a Type Coercion error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
var wmPoly:Polygon = WebMercatorUtil.geographicToWebMercator(thePolygon) as Polygon;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...Is this not the right way to convert the polygon to web mercator?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; Well, not much to go one there... So you do have the import for WebMercatorUtil right?&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137135#M3198</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2021-12-11T07:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137136#M3199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Sure that is right. For debugging try this to see if you get past this line of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var geom:Geometry = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 16:36:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137136#M3199</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-03-20T16:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137137#M3200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I get the same error.&amp;nbsp; Is it possible that despite happily printing out its geometry (per above post), thePolygon somehow contains some screwy data that's causing geographicToWebMercator to croak?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Sure that is right. For debugging try this to see if you get past this line of code:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var geom:Geometry = WebMercatorUtil.geographicToWebMercator(thePolygon);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 16:46:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137137#M3200</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2014-03-20T16:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137138#M3201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; That sounds likely. I think you are going to have to parse the JSON further as the more I think about it the addRing is expecting an array of MapPoints not an array of numbers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;once again this is me free handing this code so there maybe mistakes&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var mpArr:Array = []; var pArr:Array = JSONUtil.decode(data.polygon); for (var p:int=0; p&amp;lt;pArr.length; p++){ &amp;nbsp;&amp;nbsp;&amp;nbsp; var mp:MapPoint(pArr
[0],pArr
[1], new SpatialReference(4326)); &amp;nbsp;&amp;nbsp;&amp;nbsp; mpArr.push(mp); } thePolygon.addRing(mpArr);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137138#M3201</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T07:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137139#M3202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Daniel,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The other thing that occurs to me is where are those coordinates suppose to be in the world? For both the lat and Lon to be positive numbers you would be talking about some where in Asia if you are passing Lat then Lon?..&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 17:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137139#M3202</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-03-20T17:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137140#M3203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That was it!&amp;nbsp; I think there's something up with the values I'm putting in in the first place, but from this point I'm sure I can handle it.&amp;nbsp; Converting each point into a MapPoint makes the conversion system happy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; That sounds likely. I think you are going to have to parse the JSON further as the more I think about it the addRing is expecting an array of MapPoints not an array of numbers.&lt;BR /&gt;&lt;BR /&gt;once again this is me free handing this code so there maybe mistakes&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var mpArr:Array = [];
var pArr:Array = JSONUtil.decode(data.polygon);
for (var p:int=0; p&amp;lt;pArr.length; p++){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var mp:MapPoint(pArr
[0],pArr
[1], new SpatialReference(4326));
&amp;nbsp;&amp;nbsp;&amp;nbsp; mpArr.push(mp);
}
thePolygon.addRing(mpArr);
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137140#M3203</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2021-12-11T07:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Draw a polygon given an ordered list of lat/lon points?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137141#M3204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oh, those were just random-ish numbers. The actual numbers will be coming out of a database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Daniel,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; The other thing that occurs to me is where are those coordinates shose to be in the world? For both the lat and Lon to be positive numbers you would be talking about some where in Asia if you are paasing Lat then Lon?..&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2014 17:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/draw-a-polygon-given-an-ordered-list-of-lat-lon/m-p/137141#M3204</guid>
      <dc:creator>DanielMauer</dc:creator>
      <dc:date>2014-03-20T17:57:01Z</dc:date>
    </item>
  </channel>
</rss>

