Share via


Windows.Devices.Geolocation Namespace

Provides APIs for getting the current location or tracking the device's location over time. Location information comes from GNSS, Wi-Fi, cellular networks, IP address, or user-configured default location.

Classes

CivicAddress

Unsupported API.

GeoboundingBox

Represents a rectangle that defines a geographic area.

Geocircle

Describes a geographic circle with a center point and a radius.

Geocoordinate

Contains the information for identifying a geographic location.

GeocoordinateSatelliteData

Provides additional information about a Geocoordinate. This information is only applicable to position estimates obtained using satellite signals.

Geolocator

Provides access to the current geographic location.

Geopath

Represents an ordered series of geographic points.

Geopoint

Describes a geographic point.

Geoposition

Represents a location that may contain latitude and longitude data or venue data.

Geovisit

Represents a Visit-related state change. See Guidelines for using Visits tracking for information on how to use this feature.

GeovisitMonitor

Handles the monitoring of a user's visits when the app is in use (not in the background).

GeovisitStateChangedEventArgs

Contains information about a VisitStateChanged event.

GeovisitTriggerDetails

Manages the details of a trigger for a Visits-related background task.

PositionChangedEventArgs

Provides data for the PositionChanged event.

StatusChangedEventArgs

Provides data for the StatusChanged event.

VenueData

Represents the venue associated with a geographic location.

Structs

BasicGeoposition

The basic information to describe a geographic position.

Interfaces

IGeoshape

Interface to define a geographic shape.

Enums

AltitudeReferenceSystem

Indicates the altitude reference system to be used in defining a geographic shape.

GeolocationAccessStatus

Indicates if your app has permission to access location data.

GeoshapeType

Indicates the shape of a geographic region.

PositionAccuracy

Indicates the requested accuracy level for the location data that the application uses.

PositionSource

Indicates the source used to obtain a Geocoordinate.

PositionStatus

Indicates the ability of the Geolocator object to provide location data.

VisitMonitoringScope

Contains values that describe the intended scope of location monitoring for use with the Visits feature.

VisitStateChange

Contains values that describe a Visit-related state change.

Examples

Sample applications that use classes from this namespace include the Geolocation sample and the Geotag sample.

Remarks

The Windows.Devices.Geolocation namespace provides comprehensive location services for Windows applications. This namespace contains classes and interfaces for obtaining location data with various levels of accuracy and tracking location changes over time.

Accuracy expectations

The accuracy of the location information depends on the source. The latitude and longitude may vary within the following ranges:

  • GNSS: within approximately 10 meters
  • Wi-Fi: between approximately 30 meters and 500 meters
  • Cell towers: between approximately 300 meters and 3,000 meters
  • IP address: between approximately 300 meters and 10,000 meters

In addition to latitude and longitude, GNSS also provides information about heading, speed, and altitude. This additional information is optional when the location information comes from other sources.

Note

The system automatically selects the most appropriate location source based on availability, accuracy requirements, and power consumption considerations.

Permission requirements

Important

Location access requires explicit user permission. Always call Geolocator.RequestAccessAsync before attempting to access location data.

Key classes

  • Geolocator: Provides the primary APIs for accessing location services.
  • Geoposition: Represents a geographic position with coordinate and venue data.
  • Geocoordinate: Contains precise geographic coordinates and accuracy information.
  • GeovisitMonitor: Monitors user visits to significant locations.

Privacy and accuracy

Location services balance accuracy with battery consumption and user privacy. Consider your app's actual needs when choosing accuracy settings:

See also