Display selectable Points at runtime

720
5
05-05-2021 02:34 PM
JacobPorter
New Contributor

I am trying to get a Map that has selectable points that will navigate to a details page. These points are coming from a local database that can change often. The map will need to set these points at runtime. The map will also need to be offline. Any tips on what tools to use would be great. I have currently tried a map with graphics. 

0 Kudos
5 Replies
MikeBrownNCDOT
New Contributor II

ArcGIS might be overkill for what you are looking to do. It is more about working with points stored in a service or feature layer. You can manually add all the points at runtime as a graphics overlay, as you mentioned. This would be the same method used by pretty much any mapping library you'll use (I've used GMaps.NET for this before). 

I'm sure you are aware, but here is the tutorial for the graphics overlay: Add a point, line, and polygon | ArcGIS Runtime API for .NET | ArcGIS for Developers

You would just hand your MapViewModel a list of the points & metadata from your database at runtime and loop through, adding one point at a time. Keep in mind this isn't live data - you would refresh this cache through another bulk query & data processing.

JacobPorter
New Contributor

Thanks for the help. I am currently just doing it with Graphics. A couple of other parts of my app are it is a Xamarin Forms app and it needs to go offline and still have the maps with pins and also the ability to navigate. Not sure if Gmaps.net supports Xamarin, but will also give it a try. 

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

The approach with the best support for this scenario would be using a feature service and one of the offline map workflows (as mentioned in an earlier reply): https://developers.arcgis.com/net/offline-maps-scenes-and-data/.

A GraphicsOverlay might fit your needs, but you could also take a look at FeatureCollections which provide ToJson/FromJson methods for saving (they also support saving as portal items): https://developers.arcgis.com/net/wpf/api-reference/html/T_Esri_ArcGISRuntime_Data_FeatureCollection....

For a sample see https://developers.arcgis.com/net/wpf/sample-code/feature-collection-layer/.

0 Kudos
DvB
by
New Contributor II

I know this might be to old for you now but in case others have a similar need.

A simple way to go about this using just Graphics and GraphicsOverlays could be for you to load the points from the database, create a MapPoint for each one, and a Graphic using each MapPoint as its geometry. You can then put them into a GraphicOverlay of your choice, and use the MapView.GeoViewTapped/GeoViewDoubleTapped events to capture when a user clicks on those Graphics/Points. You could then MapView.IdentifyGraphicsOverlaysAsync(...) or just have a collection of the same points that you use to reference the latlon and if the position you get from the GeoViewTapped events is in there, go to the detail's page related to that point.

0 Kudos
DvB
by
New Contributor II

Also, you could put in each Graphic a KeyValuePair<string, object> that has some identifying information you can use to navigate to the details page. So after identifying the graphics, you can check if they have any keyvaluepair that matches what you want, and then navigate to your page, however your application handles that.

0 Kudos