Is there any example for adding features with GeometryTyp polygon in combination with SketchEditor?
I studied this example with GeometryTyp point: Add features (Feature Service) | ArcGIS for Developers , but I've not found a comparable example for GeometryTyp polygon.
Hi again,
Polygon inherits from Geometry so you can cast your geometry to a polygon once you're happy it is a polygon. Use code looking something like:
if (sketchGeometry.getGeometryType() == GeometryType.POLYGON) { Polygon polygon = (Polygon) sketchGeometry; }
or
if (sketchGeometry instanceof Polygon) { Polygon polygon = (Polygon) sketchGeometry; }
Hope this helps!
Trevor
Thank you very much! It's solved.
Thank you very much for your reply, but how can I convert the sketchGeometry to a Polygon to save it in a FeatureLayer?
Geometry sketchGeometry = mSketchEditor.getGeometry();
Hello!
The sketch editor samples does exactly that!
Cheers,
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.