Using Esri SDK for Unity

Hello!

Maybe someone is using or was using and ArcGIS Maps SDK for Unity and knows how to do “Spatial filtering”
This is what is written in documentation Screenshot-2023-11-15-142700 hosted at ImgBB — ImgBB
But I don’t quite understand, tried some methods but it didn’t worked. The thing I want to do is, I downloaded a city scene layer an uploaded it into unity and I want to delete one part of city using spatial filtering.
This is what I tried

    void CreatePolygons()
    {
        ArcGISPolygonBuilder pb = new ArcGISPolygonBuilder(ArcGISSpatialReference.WGS84());
        ArcGISCollection<ArcGISPolygon> polygons = new ArcGISCollection<ArcGISPolygon>();

        pb.AddPoint(21.129886, 55.663686);
        pb.AddPoint(21.169546, 55.673128);
        pb.AddPoint(21.189802, 55.636810);
        pb.AddPoint(21.132897, 55.631965);

        ArcGISPolygon polygon = (ArcGISPolygon)pb.ToGeometry();

        ArcGISSpatialFeatureFilter filter = new ArcGISSpatialFeatureFilter(polygons, ArcGISSpatialFeatureFilterSpatialRelationship.Disjoint);

        ArcGIS3DObjectSceneLayer layer = GameObject.Find("ArcGISMap").GetComponent<ArcGIS3DObjectSceneLayer>();
        layer.FeatureFilter = filter;
    }

If someone has some ideas how to achieve this, it would be pleasure to hear that.

Thank you!

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
  • links to documentation you used to cross-check your work (CRITICAL!!!)

The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

  • Do not TALK about code without posting it.
  • Do NOT post unformatted code.
  • Do NOT retype code. Use copy/paste properly using code tags.
  • Do NOT post screenshots of code.
  • Do NOT post photographs of code.
  • Do NOT attach entire scripts to your post.
  • ONLY post the relevant code, and then refer to it in your discussion.
    void CreateSpatialFilter(ArcGIS3DObjectSceneLayer layer)
    {
        ArcGISPolygonBuilder pb = new ArcGISPolygonBuilder(ArcGISSpatialReference.WGS84());
        ArcGISPoint point1 = new ArcGISPoint(21.131577142997067, 55.637023413731804, ArcGISSpatialReference.WGS84());
        ArcGISPoint point2 = new ArcGISPoint(21.133894571715896, 55.67290525808961, ArcGISSpatialReference.WGS84());
        ArcGISPoint point3 = new ArcGISPoint(21.15449393771106, 55.67580923146909, ArcGISSpatialReference.WGS84());
        ArcGISPoint point4 = new ArcGISPoint(21.180672298663247, 55.64579111054236, ArcGISSpatialReference.WGS84());

        pb.AddPoint(point1);
        pb.AddPoint(point2);
        pb.AddPoint(point3);
        pb.AddPoint(point4);

        ArcGISPolygon polygon = (ArcGISPolygon)pb.ToGeometry();
        ArcGISCollection<ArcGISPolygon> polygons = new ArcGISCollection<ArcGISPolygon>();
        polygons.Add(polygon);

        ArcGISSpatialFeatureFilter filter = new ArcGISSpatialFeatureFilter(polygons, ArcGISSpatialFeatureFilterSpatialRelationship.Disjoint);
        layer.FeatureFilter = filter;
    }

Found the solution.