GISBlox.Services.SDK 2.1.0

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

// Install GISBlox.Services.SDK as a Cake Tool
#tool nuget:?package=GISBlox.Services.SDK&version=2.1.0                

<h1 align="center">GISBlox Services SDK</h1>

<p align="center"> <br> <img src="GBLS.png" alt="GISBlox Location Services logo" width="120px" height="120px"/> <br><br> <i>Connect to the GISBlox Services API from .NET</i> <br> </p>

<p align="center">
<a href="https://github.com/GISBlox/gisblox-services-sdk/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/GISBlox/gisblox-services-sdk" alt="MIT license" /> </a> </p>

<hr>

Introduction

This SDK enables applications to connect to the GISBlox Services API. It supports the following Location Services:

To get no-code access to the GISBlox Services API from the command-line, you can use the GISBlox Services CLI.

Requirements

You must have a personal service key to access the GISBlox Services API.

To generate a service key, create an account in the GISBlox Account Center and add a free subscription to the GISBlox Location Services. Once subscribed, click the Location Services tile and copy the service key from the information panel. More information

Installation

Either download this repository, make a (forked) git clone or install via NuGet:

PM> Install-Package GISBlox.Services.SDK -Version 2.1.0

Usage

In the following examples, the baseUrl variable should be set to https://services.gisblox.com, and the serviceKey variable should be set to your GISBlox Location Services service key.

Creating the client

using (var client = GISBloxClient.CreateClient(baseUrl, serviceKey))
{
    // ...
}

Check out the Tests project for more detailed use cases.

Postal codes API

The postal codes API supports querying for both 4 digit and 6 digit postcal code records. Every endpoint in the Dutch Postal Codes sections of the developer portal is available in the SDK.

Projection API

The projection API reprojects WGS84 coordinates to Rijksdriehoeksstelsel (RDNew) locations and vice versa.

Reproject WGS84 coordinate to RDNew point

var coord = new Coordinate(51.998929, 4.375587);         
var rdPoint = await client.Projection.ToRDS(coord);

// Returns X:85530 Y:446100

Use the following code to reproject multiple WGS84 coordinates to RDNew locations at once:

var coords = new List<Coordinate>
{
  new Coordinate(51.998929, 4.375587),
  new Coordinate(53.1, 4.2),
  new Coordinate(53.11, 4.3)
};
var rdPoints = await client.Projection.ToRDS(coords);

// Returns X:85530 Y:446100, X:75483 Y:568787 and X:82197 Y:569794

To include the source location in the result, call the ToRDSComplete method instead of ToRDS:

await client.Projection.ToRDSComplete(coord);

// Returns X:85530 Y:446100 Lat: 51,998929 Lon: 4,375587

Reproject RDNew point to WGS84 coordinate

var rdPoint = new RDPoint(100000, 555000);         
var coord = await client.Projection.ToWGS84(rdPoint);

// Returns Lat: 52,9791861737104 Lon: 4,56833613045079

You can round the digits of the resulting coordinate to a specific amount by passing a second argument:

var coord = await client.Projection.ToWGS84(rdPoint, 6);    // Round the coordinate to 6 digits

// Returns Lat: 52,979186 Lon: 4,568336

Use the following code to reproject multiple RDNew locations to WGS84 coordinates at once:

var rdPoints = new List<RDPoint>
{
  new RDPoint(100000, 555000),
  new RDPoint(1, 2),
  new RDPoint(111000, 550000)
};
var coords = await client.Projection.ToWGS84(rdPoints);

// Returns Lat: 52,9791861737104 Lon: 4,56833613045079, Lat: 0 Lon: 0 and Lat: 52.93526683092437 Lon: 4.7327735938900535

To include the source coordinates in the result, call the ToWGS84Complete method instead of ToWGS84:

await client.Projection.ToWGS84Complete(rdPoint);

// Returns X: 100000 Y: 555000 Lat: 52,9791861737104 Lon: 4,56833613045079

Conversion API

The conversion API converts WKT geometry objects into GeoJson.

Convert WKT into GeoJson

var wkt = new WKT("POINT (30 10)");
var geoJson = await client.Conversion.ToGeoJson(wkt);

// Returns:

{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      10,
      30
    ]
  },
  "properties": {}
}

The following code converts a multipolygon into a GeoJson FeatureCollection:

var wkt = new WKT("MULTIPOLYGON (((30 20, 45 40, 10 40, 30 20)),((15 5, 40 10, 10 20, 5 10, 15 5)))");
var geoJson = await client.Conversion.ToGeoJson(wkt, true);

// Returns:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [
                20,
                30
              ],
              [
                40,
                45
              ],
              [
                40,
                10
              ],
              [
                20,
                30
              ]
            ]
          ],
          [
            [
              [
                5,
                15
              ],
              [
                10,
                40
              ],
              [
                20,
                10
              ],
              [
                10,
                5
              ],
              [
                5,
                15
              ]
            ]
          ]
        ]
      },
      "properties": {}
    }
  ]
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows 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
2.1.0 237 12/8/2023
2.0.0 139 12/1/2023
1.1.0 129 11/24/2023