BasicGeopos 1.2.3

.NET Standard 1.4
dotnet add package BasicGeopos --version 1.2.3
NuGet\Install-Package BasicGeopos -Version 1.2.3
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="BasicGeopos" Version="1.2.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BasicGeopos --version 1.2.3
#r "nuget: BasicGeopos, 1.2.3"
#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 BasicGeopos as a Cake Addin
#addin nuget:?package=BasicGeopos&version=1.2.3

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

This is library for manipulating geolocation inside ClassLibs - UWP has BasicGeolocation, Android and MAUI has Location, but in .Net we have nothing.

constructor (and similar)

new BasicGeo(latitude, longitude, altitude = 0) // args are validated since v1.1.0
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]

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 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]

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

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)

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]
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BasicGeopos:

Package Downloads
pkar.nuget.MPK The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

This package is only for Kraków, Poland - wrapper for public transport services. Although it can be used (in part) also for other TTSS based services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.3 113 3/9/2023
1.2.2 119 2/21/2023
1.2.1 101 2/21/2023
1.1.3 103 2/10/2023
1.1.2 113 2/4/2023
1.1.1 111 2/3/2023
1.1.0 128 1/31/2023
1.0.0 135 1/9/2023

Added GetCorners(List); GetCenter(List); GetCornersAndCenter(List)