Select to view content in your preferred language

What Is The Replacment For SpatialReference.Extent?

604
2
Jump to solution
06-20-2023 01:18 PM
Labels (1)
HalletBruestle
Emerging Contributor

In newer versions of the ArcGis SDK, Esri.ArcGISRuntime.Geometry.SpatialReference no longer has the Extent property. This would give the boundaries for the current map, which was useful for determining if a MapPoint is within the map (not just the visible map, anywhere on the map).

What is the replacement for SpatialReference.Extent? How does one get the maximum boundary of a Map or SpatialReference?

0 Kudos
1 Solution

Accepted Solutions
williambohrmann3
Esri Contributor

Thank you for your questions @HalletBruestle. An Envelope can be constructed with diagonal MapPoint corners and a SpatialReference to essentially create a rectangle. The Contains GeometryEngine extension method can be used to determine if a point falls inside the envelope. The Set max extent code sample shows how to get the maximum boundary of a geographic region.

Getting the extent of the entire map - so the entire projected surface of the Earth - that's an interesting problem. It's not going to be easy to accomplish programmatically. Interactively, you could subscribe to a GeoViewTapped event and get approximate the maximum envelop when clicking the southwestern-most and northeastern-most points of the map. However, that is a far from elegant solution. You'd be better off searching the web for those projected points on the web and hardcoding those values.

View solution in original post

2 Replies
williambohrmann3
Esri Contributor

Thank you for your questions @HalletBruestle. An Envelope can be constructed with diagonal MapPoint corners and a SpatialReference to essentially create a rectangle. The Contains GeometryEngine extension method can be used to determine if a point falls inside the envelope. The Set max extent code sample shows how to get the maximum boundary of a geographic region.

Getting the extent of the entire map - so the entire projected surface of the Earth - that's an interesting problem. It's not going to be easy to accomplish programmatically. Interactively, you could subscribe to a GeoViewTapped event and get approximate the maximum envelop when clicking the southwestern-most and northeastern-most points of the map. However, that is a far from elegant solution. You'd be better off searching the web for those projected points on the web and hardcoding those values.

williambohrmann3
Esri Contributor

Just a few more details - MaxExtent will allow you to limit the extent of the map. The maximum extent is calculated from the union of the full extent of all basemap layers. Envelope has properties for the min/max of X and Y coordinates.

0 Kudos