pkar.BasicGeopos 1.5.7

Prefix Reserved
dotnet add package pkar.BasicGeopos --version 1.5.7                
NuGet\Install-Package pkar.BasicGeopos -Version 1.5.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pkar.BasicGeopos" Version="1.5.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pkar.BasicGeopos --version 1.5.7                
#r "nuget: pkar.BasicGeopos, 1.5.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install pkar.BasicGeopos as a Cake Addin
#addin nuget:?package=pkar.BasicGeopos&version=1.5.7

// Install pkar.BasicGeopos as a Cake Tool
#tool nuget:?package=pkar.BasicGeopos&version=1.5.7                

This is library for manipulating geolocation inside ClassLibs - UWP has BasicGeolocation, Android and MAUI has Location, but in .Net we have nothing. For file that can be included in your project to map between UWP structs/classes, see https://github.com/pkar70/MyLibs/blob/master/UWPappTel/UwpGeopos.vb (it cannot be packed to Nuget, as UWP Runtime Libraries doesn't allow types defined outside of WinRT)

constructor (and similar)

new BasicGeo(latitude, longitude, altitude = 0) // args are validated since v1.1.0
new BasicGeo(latitude As String, longitude As String, altitude  As String = "0") // since v1.2.4
new BasicGeo()  // since v1.2.6
Function Clone  // [since v1.1.0]
Function FromObject(anyObject as Object)    // tries to extract data from given object [since v1.1.0]
Function FromLink(baselink, link)   // tries to create BasicGeopos from map link [since v.1.2.1]
Function FromOSMLink(link)   // tries to create BasicGeopos from OSM link [since v.1.2.1]
FromExifString(String) // tries to create BasicGepos from EXIF formatted string [since v1.2.7]

various distance metering

Function DistanceTo(dLatitude As Double, dLongitude As Double) As Double
Function DistanceTo(oGeoPos As BasicGeopos) As Double
Function DistanceKmTo(dLatitude As Double, dLongitude As Double) As Double // [since 1.1.2]
Function DistanceKmTo(oGeoPos As BasicGeopos) As Double

Function IsNear(oGeoPos As BasicGeopos, distanceMeters As Double) As Boolean
Operator -(ByVal oGeoPos0 As BasicGeopos, ByVal oGeoPos1 As BasicGeopos) As Double

checking if BasicGeopos is inside various areas

Function IsLatitudeBetween(value0 As Double, value1 As Double) As Boolean
Function IsLongitudeBetween(value0 As Double, value1 As Double) As Boolean

Function IsInsideRectangle(latMin As Double, latMax As Double, lonMin As Double, lonMax As Double) As Boolean
Function IsInsideRectangle(oGeoPos0 As BasicGeopos, oGeoPos1 As BasicGeopos) As Boolean

Function IsInsideCircle(center As BasicGeopos, radius As Double) As Boolean

get centers of some regions

You can treat it as another form of constructors

GetEuropeCenter()   // "Mainland Europe"
GetEUCenter()       // "In Europe, not including overseas territories"
GetPolandCenter()
GetKrakowCenter()
Empty() // <=> (0,-150), middle of ocean; to make some scenarios easier
GetCenter(locations As List(Of BasicGeopos))    // since 1.2.3

tests if we are inside one of these

These tests are done as IsInsideRectangle, not IsInsideCircle

Function IsInsideEurope() As Boolean
Function IsInsideEU() As Boolean
Function IsInsidePoland() As Boolean
Function IsInsideKrakow() As Boolean

Function IsEmpty() As Boolean   // test if current BasicGeopos is Empty one

working with other .Net geolocation types

Function FromObject(anyObject as Object)    // tries to extract data from given object [since v1.1.0]
Sub CopyTo(anyObject as Object)             // tries to copy data to given object [since v1.2.1]

serialization etc.

Helpers, to avoid warnings that ToString should have CultureInfo, etc. Default precision is 5 digits, it is about 10 meters.

Function StringLat(Optional iDigits As Integer = 5) As String
Function StringLon(Optional iDigits As Integer = 5) As String
Function StringAlt() As String // since 1.2.4

Function FormatLink(sBaseLink As String) As String  // replace %lat , %lon with values; since 1.2.1 also %alt
Function FormatLink(sBaseLink As String, zoomLevel) As String  // as above, but also %zoom [since 1.2.1]
Function ToOSMLink(Optional zoom As Integer = 16) As String
Function ToOSMUri(Optional zoom As Integer = 16) As Uri [since 1.2.1]
Function DumpAsJson() As String // dump as one-line JSON token [since v1.1.0]


Shared MapServices As Dictionary(Of String, String)    // since 1.2.4
Function ToLink(mapService As String, Optional zoom As Integer = 16) As String // since 1.2.4
Function ToUri(mapService As String, Optional zoom As Integer = 16) As Uri // since 1.2.4
Function GetFromLink(link As String) As BasicGeopos // since 1.2.4

DMS (degree, minute, second)

Function StringLatDM(Optional sFormat As String = "%d°%m′%s″", Optional iDigits As Integer = 5) As String
Function StringLonDM(Optional sFormat As String = "%d°%m′%s″", Optional iDigits As Integer = 5) As String
Function ToStringDM(format, Optional iDigits = 5) As String

and constructors

FromDMS(latD As Integer, latM As Double, latS As Double, latSN As String, lonD As Integer, lonM As Double, lonS As Double, lonEW As String) 
FromDM(latD As Integer, latM As Double, latSW As String, lonD As Integer, lonM As Double, lonEW As String)
FromDM(latD As Double, latSW As String, lonD As Double, lonEW As String)

QTH locator converter

See also https://en.wikipedia.org/wiki/Maidenhead_grid_locator

Function ToQTH(Optional depth As UInt16 = 4) As String [since v1.4.0]
Shared Function FromQTH(qth As String) As BasicGeopos [since v1.4.0]

Working with BasicGeopos lists

These functions are not related to one geopoint, so they are defined as shared/static.

Public Shared Function GetCenter(locations As List(Of BasicGeopos)) As BasicGeopos  // [since v1.2.3]
Public Shared Function GetCorners(locations As List(Of BasicGeopos)) As List(Of BasicGeopos)    // [since v1.2.3]
Public Shared Function GetCornersAndCenter(locations As List(Of BasicGeopos)) As List(Of BasicGeopos)   // [since v1.2.3]

Known mapservices:

  • arcgis
  • bing
  • google
  • openstreetmap
  • wirtszlaki (https://mapa.wirtualneszlaki.pl/) // since v1.2.8:
  • geouri (geo: without altitude)
  • geouriAlt (geo: with altitude) // since v1.5.0
  • geohack
  • herewego
  • copernix
  • wikimap
  • oldmaps

BasicGeoposWithRadius

Same as BasicGeopos, but with Radius. So, IsInsideCircle method is changed, as we already have radius known:

Function IsInsideCircle(center As BasicGeoposWithRadius) As Boolean
Function IsInsideCircle(center As BasicGeopos) As Boolean
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.4 is compatible.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 was computed.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.7 85 11/30/2024
1.5.4 115 6/23/2024
1.4.0 188 9/3/2023
1.3.1 145 8/22/2023
1.3.0 168 8/17/2023
1.2.8 157 6/15/2023
1.2.7 190 4/10/2023
1.2.6 196 4/7/2023
1.2.5 186 4/7/2023
1.2.4 204 4/7/2023 1.2.4 is deprecated.

add: empty BasicGeoposWithRadius (for JSON deserialization), mapa-turystyczna.pl service