<?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: Polygon with outline and holes in Java Maps SDK Questions</title>
    <link>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122576#M2530</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/542937"&gt;@RobertSchweikert&lt;/a&gt;&amp;nbsp;yes you can do both of these things.&amp;nbsp; How are you wanting to store them?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you wanting to store them in a feature layer or a graphic overlay?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Dec 2021 17:26:21 GMT</pubDate>
    <dc:creator>MarkBaird</dc:creator>
    <dc:date>2021-12-03T17:26:21Z</dc:date>
    <item>
      <title>Polygon with outline and holes</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122553#M2529</link>
      <description>&lt;P&gt;Hi, How are outlines and holes of a polygon stored in the Polygon java object in the runtime API? And what about multipolygons? How are they stored?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 16:16:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122553#M2529</guid>
      <dc:creator>RobertSchweikert</dc:creator>
      <dc:date>2021-12-03T16:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon with outline and holes</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122576#M2530</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/542937"&gt;@RobertSchweikert&lt;/a&gt;&amp;nbsp;yes you can do both of these things.&amp;nbsp; How are you wanting to store them?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you wanting to store them in a feature layer or a graphic overlay?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 17:26:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122576#M2530</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2021-12-03T17:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon with outline and holes</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122874#M2531</link>
      <description>&lt;P&gt;If you are wanting to draw a polygon with a hole in it, the following method shows how this can be achieved.&amp;nbsp; The polygon is made up of "parts" which form the inner and out rings of your polygon with a hole it it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;  private Polygon makePolygonWithHole() {
    // create a new point collection for polygon
    PointCollection outerPoints = new PointCollection(SpatialReferences.getWebMercator());

    // create and add points to the point collection
    outerPoints.add(new Point(2000, 2000));
    outerPoints.add(new Point(2000, 4000));
    outerPoints.add(new Point(4000, 4000));
    outerPoints.add(new Point(4000, 2000));

    Part outerPart = new Part(outerPoints);

    // inner part (the hole)
    PointCollection innerPoints = new PointCollection(SpatialReferences.getWebMercator());

    innerPoints.add(new Point(3500,2500));
    innerPoints.add(new Point(3500,3500));
    innerPoints.add(new Point(2500,3500));
    innerPoints.add(new Point(2500,2500));

    Part innerPart = new Part(innerPoints);

    // make parts for multi part polygon
    PartCollection partCollection = new PartCollection(SpatialReferences.getWebMercator());
    partCollection.add(outerPart);
    partCollection.add(innerPart);

    // create the polyline from the point collection
    Polygon polygon = new Polygon(partCollection);

    return (Polygon) GeometryEngine.simplify(polygon);
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The polygon can be used in features (persisted in a feature service for example), or a graphics overlay.&amp;nbsp; I've shown some simple code below which shows how to draw the polygon in a graphics overlay:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;      // create a map view and set the map to it
      mapView = new MapView();
      mapView.setMap(map);

      GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
      mapView.getGraphicsOverlays().add(graphicsOverlay);

      SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF0063FF, 1);

      SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, 0xFF00FF00, lineSymbol);

      Graphic graphicWithHole = new Graphic(makePolygonWithHole(), fillSymbol);

      graphicsOverlay.getGraphics().add(graphicWithHole);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MarkBaird_0-1638789596096.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/28865iB22A8FACD1E04326/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MarkBaird_0-1638789596096.png" alt="MarkBaird_0-1638789596096.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Multi part polygons can also be created with parts.&lt;/P&gt;&lt;P&gt;Does this help?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 11:20:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1122874#M2531</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2021-12-06T11:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon with outline and holes</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1123721#M2532</link>
      <description>&lt;P&gt;Thanks Mark, this is super helpful. If you could also share about the read process for polygons with outlines and holes like specifically how is reading a multipolygon with let's say three parts (3 polygons) different from reading a polygon with 1outline and 2 holes. Is my understanding of creation of a multipolygon correct?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 09:07:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1123721#M2532</guid>
      <dc:creator>RobertSchweikert</dc:creator>
      <dc:date>2021-12-08T09:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Polygon with outline and holes</title>
      <link>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1124810#M2534</link>
      <description>&lt;P&gt;Reading the polygon is just the same as creating it.&amp;nbsp; From the polygon class you can get the parts which make up the polygon rings.&lt;/P&gt;&lt;P&gt;You can have multiple rings (parts) which can make up a multi-part polygon.&amp;nbsp; For example you could have a polygon representing the multiple islands which make up the Outer Hebrides.&lt;/P&gt;&lt;P&gt;You can also have rings inside rings, and even rings in side rings, which are inside rings!&amp;nbsp; This allows you to make items like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- An island which has a lake in it&lt;/P&gt;&lt;P&gt;&amp;nbsp;- An island which has a lake, and the lake has another island which in turn has its own lake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2021 11:32:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/java-maps-sdk-questions/polygon-with-outline-and-holes/m-p/1124810#M2534</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2021-12-10T11:32:43Z</dc:date>
    </item>
  </channel>
</rss>

