Select to view content in your preferred language

Spatial filtering to remove 3D objects from layer

389
1
11-14-2023 01:02 AM
DeivydasMažeika
New Contributor

I want to remove block from 3D models layer and insert my own created 3D building. But I don't know how to achieve this. I read there is Spatial Filtering, but I don't know how to use it, how to draw a polygon.

1 Reply
Deivydas24
Emerging Contributor
	void CreateSpatialFilter(ArcGIS3DObjectSceneLayer layer)
	{
		ArcGISPolygonBuilder pb = new ArcGISPolygonBuilder(ArcGISSpatialReference.WGS84());
		ArcGISPoint point1 = new ArcGISPoint(-73.99980079704791, 40.70807170346215, ArcGISSpatialReference.WGS84());
		ArcGISPoint point2 = new ArcGISPoint(-74.0133251342158, 40.70044995342926, ArcGISSpatialReference.WGS84());
		ArcGISPoint point3 = new ArcGISPoint(-74.01934729189811, 40.705750450644196, ArcGISSpatialReference.WGS84());
		ArcGISPoint point4 = new ArcGISPoint(-74.01291685233905, 40.71700777141413, 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;
	}

The code block which worked for me. Well with the New York example from tutorial.
0 Kudos