<?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 Why can't I search for elements? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215427#M8783</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to find lines on which there are points that I would then connect into a line. The problem is that as soon as I look for points intersecting the line, it doesn't find any even though I know they must be there.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="průnik.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52004i186B794D24706145/image-size/medium?v=v2&amp;amp;px=400" role="button" title="průnik.PNG" alt="průnik.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One line example&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; if (!(MapView.Active.Map.FindLayers("Z_Voda_L ").First() is FeatureLayer vodaLayer))
                return;
   FeatureClass fcVoda = vodaLayer.GetTable() as FeatureClass;
 if (!(MapView.Active.Map.FindLayers("featureToVer").First() is FeatureLayer featureToVer))
                    return;
                FeatureClass fcFeatureToVer = featureToVer.GetTable() as FeatureClass;
 var qfilter = new QueryFilter
                {
                    WhereClause = "OBJECTID &amp;gt;= 0"
                };
  var vodaPruchod = fcVoda.Search(qfilter);

 while (vodaPruchod.MoveNext())
                {
                    var vodaFeature = vodaPruchod.Current as Feature;
                    var body = vodaFeature.GetShape() as Polyline;
                    var spatialQueryFilter = new SpatialQueryFilter()
                    { FilterGeometry = body, SpatialRelationship = SpatialRelationship.Intersects};
                    var polyCursor = fcFeatureToVer.Search(spatialQueryFilter, false);
                    var mapoveBody = new List&amp;lt;MapPoint&amp;gt;();
                    while (polyCursor.MoveNext())
                    {
                        var bodAktual = polyCursor.Current as Feature;
                        var mapPoint = bodAktual.GetShape() as MapPoint;
                        mapoveBody.Add(mapPoint);
                    }
}
}&lt;/LI-CODE&gt;&lt;P&gt;The polyline is always selected because I see it always has a length, but I don't know why it doesn't find any point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be glad for any advice and help&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2022 07:25:16 GMT</pubDate>
    <dc:creator>DavidMrázek</dc:creator>
    <dc:date>2022-09-23T07:25:16Z</dc:date>
    <item>
      <title>Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215427#M8783</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to find lines on which there are points that I would then connect into a line. The problem is that as soon as I look for points intersecting the line, it doesn't find any even though I know they must be there.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="průnik.PNG" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/52004i186B794D24706145/image-size/medium?v=v2&amp;amp;px=400" role="button" title="průnik.PNG" alt="průnik.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One line example&lt;/P&gt;&lt;P&gt;my code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; if (!(MapView.Active.Map.FindLayers("Z_Voda_L ").First() is FeatureLayer vodaLayer))
                return;
   FeatureClass fcVoda = vodaLayer.GetTable() as FeatureClass;
 if (!(MapView.Active.Map.FindLayers("featureToVer").First() is FeatureLayer featureToVer))
                    return;
                FeatureClass fcFeatureToVer = featureToVer.GetTable() as FeatureClass;
 var qfilter = new QueryFilter
                {
                    WhereClause = "OBJECTID &amp;gt;= 0"
                };
  var vodaPruchod = fcVoda.Search(qfilter);

 while (vodaPruchod.MoveNext())
                {
                    var vodaFeature = vodaPruchod.Current as Feature;
                    var body = vodaFeature.GetShape() as Polyline;
                    var spatialQueryFilter = new SpatialQueryFilter()
                    { FilterGeometry = body, SpatialRelationship = SpatialRelationship.Intersects};
                    var polyCursor = fcFeatureToVer.Search(spatialQueryFilter, false);
                    var mapoveBody = new List&amp;lt;MapPoint&amp;gt;();
                    while (polyCursor.MoveNext())
                    {
                        var bodAktual = polyCursor.Current as Feature;
                        var mapPoint = bodAktual.GetShape() as MapPoint;
                        mapoveBody.Add(mapPoint);
                    }
}
}&lt;/LI-CODE&gt;&lt;P&gt;The polyline is always selected because I see it always has a length, but I don't know why it doesn't find any point.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be glad for any advice and help&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 07:25:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215427#M8783</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-09-23T07:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215463#M8784</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Somethimes spatial filter doesn't work if spatial references of FilterGeometry and FeatureClass differs. Then you need to reproject FilterGeometry&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 10:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215463#M8784</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-09-23T10:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215464#M8785</link>
      <description>&lt;P&gt;I'm probably asking a stupid question, but how is it done?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 10:52:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215464#M8785</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-09-23T10:52:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215465#M8786</link>
      <description>&lt;P&gt;Project or check spatial references?&lt;/P&gt;&lt;P&gt;To project use code like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var sr = fcFeatureToVer.GetDefinition().GetSpatialReference();
...
FilterGeometry = GeometryEngine.Instance.Project(body, sr);&lt;/LI-CODE&gt;&lt;P&gt;To check spatial references place breakpoint near spatialQueryFilter add body and&amp;nbsp;fcFeatureToVer to VS watch list and investigate&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 11:04:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215465#M8786</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-09-23T11:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215473#M8787</link>
      <description>&lt;P&gt;Now it gives me this error: 'Invalid URI: The format of the URI could not be determined.'&lt;BR /&gt;&lt;BR /&gt;Is it possible that this is the wrong path? Where did I save it...&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 12:23:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215473#M8787</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-09-23T12:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215475#M8788</link>
      <description>&lt;P&gt;Which line generates the error? There is no code for saving in your pasted code.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 12:33:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215475#M8788</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2022-09-23T12:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215942#M8795</link>
      <description>&lt;P&gt;var sr = fcFeatureToVer.GetDefinition().GetSpatialReference();&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2022 06:02:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215942#M8795</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-09-26T06:02:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why can't I search for elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215943#M8796</link>
      <description>&lt;P&gt;This is my entire code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; protected override async void OnClick()
        {
            if (!(MapView.Active.Map.FindLayers("Z_Voda_L ").First() is FeatureLayer vodaLayer))
                return;
            if (!(MapView.Active.Map.FindLayers("Z_KomSilnice_L ").First() is FeatureLayer komLayer))
                return;

            await QueuedTask.Run(async () =&amp;gt;
            {
                Map activeMap = MapView.Active.Map;
                string fileBufferVoda = @"D:\BufferVoda.shp";
                object[] bufferParaVoda =
                    {vodaLayer, fileBufferVoda, "1 Meters", "FULL", "ROUND", "LIST", "", "PLANAR"};
                await StartATask("analysis.Buffer", bufferParaVoda);
                string fileBufferSilnice = @"D:\BufferSilnice.shp"; ;
                object[] bufferParaSilnice =
                    {komLayer, fileBufferSilnice, "2 Meters", "FULL", "ROUND", "LIST", "", "PLANAR"};
                await StartATask("analysis.Buffer", bufferParaSilnice);
                string output = @"D:\PairwiseIntersect.shp";
                await CreateFcWithAttributesAsync("LinieKoncovychBodu", EnumFeatureClassType.Polyline);
                var polylineFeatureLayer = activeMap.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().FirstOrDefault(lyr =&amp;gt; lyr.ShapeType == esriGeometryType.esriGeometryPolyline);
                string silnice = "BufferSilnice";
                string voda = "BufferVoda";
                var qfilter = new QueryFilter
                {
                    WhereClause = "OBJECTID &amp;gt;= 0"
                };
                FeatureClass fcVoda = vodaLayer.GetTable() as FeatureClass;
                var editace = new EditOperation
                {
                    Name = "Posun anotace",
                    SelectNewFeatures = false
                };
                var insp = new Inspector();
                FeatureLayer bufferSilnice = MapView.Active.Map.FindLayers(silnice).First() as FeatureLayer;
                FeatureLayer bufferVoda = MapView.Active.Map.FindLayers(voda).First() as FeatureLayer;
                object[] inputFields = { bufferVoda + ";" + bufferSilnice };
                object[] parametrPair =
                    {inputFields, output , "ALL", "", "INPUT"};
                await StartATask("analysis.PairwiseIntersect", parametrPair);
                var vodaPruchod = fcVoda.Search(qfilter);
                string outputVer = @"D:\featureToVer.shp";
                object[] parametrVer =
                    {vodaLayer, outputVer , "ALL"};
                await StartATask("management.FeatureVerticesToPoints", parametrVer);
                if (!(MapView.Active.Map.FindLayers("featureToVer").First() is FeatureLayer featureToVer))
                    return;
                FeatureClass fcFeatureToVer = featureToVer.GetTable() as FeatureClass;
                var sr = fcFeatureToVer.GetDefinition().GetSpatialReference();
                //SpatialReferenceBuilder srBuilder = new SpatialReferenceBuilder(3857);//zkusit dát tohle jako referenci

                if (!(MapView.Active.Map.FindLayers("PairwiseIntersect").First() is FeatureLayer pairwise))
                    return;
                FeatureClass fcPairwise = pairwise.GetTable() as FeatureClass;
                var createOperation = new EditOperation();
                var polylineFeatureClass = polylineFeatureLayer.GetTable() as FeatureClass;
                var polylineDefinition = polylineFeatureClass.GetDefinition();
                var linie = new List&amp;lt;Polyline&amp;gt;();
                while (vodaPruchod.MoveNext())
                {
                    var vodaFeature = vodaPruchod.Current as Feature;
                    var body = vodaFeature.GetShape() as Polyline;
                    var spatialQueryFilter = new SpatialQueryFilter()
                    { FilterGeometry = GeometryEngine.Instance.Project(body, sr), SpatialRelationship = SpatialRelationship.Intersects};
                    var polyCursor = fcFeatureToVer.Search(spatialQueryFilter, false);
                    var mapoveBody = new List&amp;lt;MapPoint&amp;gt;();
                    while (polyCursor.MoveNext())
                    {
                        var bodAktual = polyCursor.Current as Feature;
                        var mapPoint = bodAktual.GetShape() as MapPoint;
                        mapoveBody.Add(mapPoint);
                    }
                    var newPolyline = PolylineBuilder.CreatePolyline(mapoveBody, polylineDefinition.GetSpatialReference());
                    linie.Add(newPolyline);
                    var list = new Dictionary&amp;lt;long, string&amp;gt;();
                    var filter = new QueryFilter
                    {
                        WhereClause = "FID = 0"
                    };
                    var stranaHorni = fcPairwise.Search(filter);
                    while (stranaHorni.MoveNext())
                    {
                        var aktualniPrvek = stranaHorni.Current as Feature;
                        var hledanyBod = aktualniPrvek.GetShape() as Polygon;
                        var spatialQuery = new SpatialQueryFilter()
                        { FilterGeometry = hledanyBod, SpatialRelationship = SpatialRelationship.Contains };
                        var polyCursor3 = fcFeatureToVer.Search(spatialQuery, false);
                        while (polyCursor3.MoveNext())
                        {
                            var oid = polyCursor3.Current.GetObjectID();
                            var aktualni = polyCursor3.Current;
                            var jmeno = aktualni["JMENO"].ToString();
                            list.Add(oid, jmeno);
                        }
                    }
                    foreach (var item in list)
                    {
                        var oid = item.Key;
                        insp.Load(featureToVer, oid);
                        var shape = insp.Shape;
                        var posun = GeometryEngine.Instance.Move(shape, -10, -10) as MapPoint;
                        insp.Shape = posun;
                        editace.Modify(insp);
                    }
                    foreach (var line in linie)
                    {
                        createOperation.Create(polylineFeatureLayer, line);
                    }
                }
                await createOperation.ExecuteAsync();

                await editace.ExecuteAsync();
            });
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 26 Sep 2022 06:04:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/why-can-t-i-search-for-elements/m-p/1215943#M8796</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2022-09-26T06:04:36Z</dc:date>
    </item>
  </channel>
</rss>

