<?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: mapViewProxy.identifyGraphicsOverlays returns only one object per layer in Swift Maps SDK Questions</title>
    <link>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547768#M442</link>
    <description>&lt;P&gt;I see. The problem is that each "result" (&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/identifygraphicsoverlayresult" target="_self"&gt;&lt;EM&gt;IdentifyGraphicsOverlayResult&lt;/EM&gt;&lt;/A&gt; type) contains the identified geo-elements for a single graphics overlay. You can access the identified geo-elements, or in this case, the graphics, in each result object, with&amp;nbsp;&lt;EM&gt;identifyResult.graphics&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;See the following code snippet as an example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="swift"&gt;struct ContentView: View {
    @State private var map = Map(basemapStyle: .arcGISLightGray)
    
    @State private var graphicsOverlays: [GraphicsOverlay] = {
        let g1 = Graphic(geometry: Point(latitude: 34.05, longitude: -117), symbol: SimpleMarkerSymbol(color: .red))
        let g2 = Graphic(geometry: Point(latitude: 33.95, longitude: -117), symbol: SimpleMarkerSymbol(color: .blue))
        let g3 = Graphic(geometry: Point(latitude: 34, longitude: -117.05), symbol: SimpleMarkerSymbol(color: .yellow))
        let g4 = Graphic(geometry: Point(latitude: 34, longitude: -116.95), symbol: SimpleMarkerSymbol(color: .green))
        
        let overlay1 = GraphicsOverlay(graphics: [g1, g2])
        let overlay2 = GraphicsOverlay(graphics: [g3, g4])
        return [overlay1, overlay2]
    }()
    
    @State private var screenPoint: CGPoint?
    
    var body: some View {
        MapViewReader { proxy in
            MapView(map: map, graphicsOverlays: graphicsOverlays)
                .onSingleTapGesture { screenPoint, _ in
                    self.screenPoint = screenPoint
                }
                .task(id: screenPoint) {
                    guard let screenPoint,
                          let identifyResult = try? await proxy.identifyGraphicsOverlays(
                            screenPoint: screenPoint,
                            tolerance: 10,
                            maximumResultsPerOverlay: nil  // nil means unlimited result count
                          )
                    else {
                        return
                    }
                    print(identifyResult.count) // 2 because we have 2 overlays
                    print(identifyResult.flatMap(\.graphics).count)  // 4 because we have 4 graphics
                }
        }
    }
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2024 20:55:32 GMT</pubDate>
    <dc:creator>Ting</dc:creator>
    <dc:date>2024-10-10T20:55:32Z</dc:date>
    <item>
      <title>mapViewProxy.identifyGraphicsOverlays returns only one object per layer</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547507#M439</link>
      <description>&lt;P&gt;I have added multiple objects to the same coordinate and layer. I have four layers and tried adding multiple objects for each layers but when I tap on the object it returns an array only with 4 elements - one per layer.&lt;/P&gt;&lt;P&gt;I also set maximumResultsPerOverlay to both a high number and to nil as well - neither of these worked.&lt;/P&gt;&lt;P&gt;The code I refer to:&lt;/P&gt;&lt;LI-CODE lang="swift"&gt;ArcGIS.MapViewReader { proxy in
            ArcGIS.MapView(map: model.map,
                           viewpoint: model.viewpoint,
                           graphicsOverlays: model.graphicsOverlays)
            .onSingleTapGesture { screenPoint, mapPoint in
                onSingleTapGesture(screenPoint: screenPoint, mapPoint: mapPoint, proxy: proxy)
            }
            ...
        }
    }

    private func onSingleTapGesture(screenPoint: CGPoint, mapPoint: ArcGIS.Point, proxy: ArcGIS.MapViewProxy) {
        Task {
            guard !model.geometryEditor.isStarted,
                  let identifiedGraphicsOverlays = try? await proxy.identifyGraphicsOverlays(screenPoint: screenPoint,
                                                                                             tolerance: 100,
                                                                                             maximumResultsPerOverlay: &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; else {
                return
            }
            // Here identifiedGraphicsOverlays.count = 4
            ...
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;I'm using v200.5.1.&lt;/P&gt;&lt;P&gt;Is it a known issue?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 09:35:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547507#M439</guid>
      <dc:creator>zdtorok</dc:creator>
      <dc:date>2024-10-10T09:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: mapViewProxy.identifyGraphicsOverlays returns only one object per layer</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547752#M440</link>
      <description>&lt;P&gt;Just want to clarify, are you trying to identify on &lt;STRONG&gt;layers&lt;/STRONG&gt; or &lt;STRONG&gt;graphics&lt;/STRONG&gt; &lt;STRONG&gt;overlays&lt;/STRONG&gt;?&lt;/P&gt;
&lt;P&gt;The former uses this API:&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/geoviewproxy/identifylayers(screenpoint:tolerance:returnpopupsonly:maximumresultsperlayer:)" target="_self"&gt;identifyLayers(screenPoint:tolerance:returnPopupsOnly:maximumResultsPerLayer:)&lt;/A&gt;, whereas the latter uses this:&amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/geoviewproxy/identifygraphicsoverlays(screenpoint:tolerance:returnpopupsonly:maximumresultsperoverlay:)" target="_self"&gt;identifyGraphicsOverlays(screenPoint:tolerance:returnPopupsOnly:maximumResultsPerOverlay:)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 20:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547752#M440</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2024-10-10T20:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: mapViewProxy.identifyGraphicsOverlays returns only one object per layer</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547760#M441</link>
      <description>&lt;P&gt;I am identifying graphics overlays, and use &amp;nbsp;&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/geoviewproxy/identifygraphicsoverlays(screenpoint:tolerance:returnpopupsonly:maximumresultsperoverlay:)" target="_blank"&gt;identifyGraphicsOverlays(screenPoint:tolerance:returnPopupsOnly:maximumResultsPerOverlay:)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 20:39:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547760#M441</guid>
      <dc:creator>zdtorok</dc:creator>
      <dc:date>2024-10-10T20:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: mapViewProxy.identifyGraphicsOverlays returns only one object per layer</title>
      <link>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547768#M442</link>
      <description>&lt;P&gt;I see. The problem is that each "result" (&lt;A href="https://developers.arcgis.com/swift/api-reference/documentation/arcgis/identifygraphicsoverlayresult" target="_self"&gt;&lt;EM&gt;IdentifyGraphicsOverlayResult&lt;/EM&gt;&lt;/A&gt; type) contains the identified geo-elements for a single graphics overlay. You can access the identified geo-elements, or in this case, the graphics, in each result object, with&amp;nbsp;&lt;EM&gt;identifyResult.graphics&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;See the following code snippet as an example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="swift"&gt;struct ContentView: View {
    @State private var map = Map(basemapStyle: .arcGISLightGray)
    
    @State private var graphicsOverlays: [GraphicsOverlay] = {
        let g1 = Graphic(geometry: Point(latitude: 34.05, longitude: -117), symbol: SimpleMarkerSymbol(color: .red))
        let g2 = Graphic(geometry: Point(latitude: 33.95, longitude: -117), symbol: SimpleMarkerSymbol(color: .blue))
        let g3 = Graphic(geometry: Point(latitude: 34, longitude: -117.05), symbol: SimpleMarkerSymbol(color: .yellow))
        let g4 = Graphic(geometry: Point(latitude: 34, longitude: -116.95), symbol: SimpleMarkerSymbol(color: .green))
        
        let overlay1 = GraphicsOverlay(graphics: [g1, g2])
        let overlay2 = GraphicsOverlay(graphics: [g3, g4])
        return [overlay1, overlay2]
    }()
    
    @State private var screenPoint: CGPoint?
    
    var body: some View {
        MapViewReader { proxy in
            MapView(map: map, graphicsOverlays: graphicsOverlays)
                .onSingleTapGesture { screenPoint, _ in
                    self.screenPoint = screenPoint
                }
                .task(id: screenPoint) {
                    guard let screenPoint,
                          let identifyResult = try? await proxy.identifyGraphicsOverlays(
                            screenPoint: screenPoint,
                            tolerance: 10,
                            maximumResultsPerOverlay: nil  // nil means unlimited result count
                          )
                    else {
                        return
                    }
                    print(identifyResult.count) // 2 because we have 2 overlays
                    print(identifyResult.flatMap(\.graphics).count)  // 4 because we have 4 graphics
                }
        }
    }
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 20:55:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/swift-maps-sdk-questions/mapviewproxy-identifygraphicsoverlays-returns-only/m-p/1547768#M442</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2024-10-10T20:55:32Z</dc:date>
    </item>
  </channel>
</rss>

