AnsweredAssumed Answered

What is the best way to find a point or midpoint for a highlighted polyline from the 'geometry' or 'feature' of the component ?

Question asked by MaryAnn.Chiramattel on Jul 26, 2016
Latest reply on Jul 28, 2016 by MaryAnn.Chiramattel

I have a scenario I am working on where when I click the sidebar with results, I need to open a popup and highlight the graphic of the selected result from the sidebar.

 

Although the graphic is always highlighted correctly for the polyline, the popup is not always consistently pointing to the polyline. Most of the time the popup points few inches away or in some case really far away from the highlighted graphic. Since the user is not directly clicking on the map, but on the sidebar, I need to explicitly pass the location for the popUp.

 

What is the best way to figure out the location of the polyLine for its popUp ?

 

Currently I am using the following to find the location for polyline. But as you can see in the screenshot, the popUp is displayed away from the polyline.

 

mapView.popup.open ({

                location: selectedResult.feature.geometry.extent.center,

                features: [selectedResult.feature]

            });

 

 

 

I am able to correctly point the popUp for point : selectedResult.feature.geometry and for a

polygon : selectedResult.feature.geometry.centroid, but for the polyLine it is not working correctly.

Outcomes