Code Monkey home page Code Monkey logo

sharpproj's Introduction

SharpProj - Providing OSGEO PROJ for .Net (Core)

latest version CI

Use the real OSGeo PROJ implementation, implemented the .Net way, reusable and available as simple to use package on NuGet.

https://www.nuget.org/packages/SharpProj/

Usage

using SharpProj;

using var rd = CoordinateReferenceSystem.CreateFromEpsg(28992);
using var wgs84 = CoordinateReferenceSystem.CreateFromEpsg(4326);

var area = rd.UsageArea;
Assert.AreEqual("Netherlands - onshore, including Waddenzee, Dutch Wadden Islands and 12-mile offshore coastal zone.", area.Name);

using (var t = CoordinateTransform.Create(rd, wgs84))
{
    var r = t.Apply(new PPoint(155000, 463000));
    Assert.AreEqual(new PPoint(52.155, 5.387), r.ToXY(3)); // Round to 3 decimals for easy testing
}

Building SharpProj

Setup build environment using:

mkdir dev
cd dev
git clone https://github.com/Microsoft/vcpkg.git
git clone https://github.com/AmpScm/SharpProj.git
cd vcpkg
bootstrap-vcpkg.bat
vcpkg install proj[core,tiff]:x86-windows-static-md proj[core,tiff]:x64-windows-static-md tiff[core,lzma,zip]:x86-windows-static-md tiff[core,lzma,zip]:x64-windows-static-md
cd ..

The explicit feature selection here explicitly builds PROJ without the builtin network support to remove the curl dependency. It also disables 'jpeg' support in tiff. This shrinks the library and allows configuring http(s) the .NET way. The network requests are just forwared to the .Net WebClient class using a bit of code in SharpProj (see ProjNetworkHandler.cpp).

This script handles the assumption inside SharpProj that the library and header files required can be found in ../vcpkg/installed/. If you choose a different layout you will need a custom setup later on. But with just this you are now able to build using either Visual Studio 2019 or 2022.

sharpproj's People

Contributors

rhuijben avatar dependabot[bot] avatar mrbeee avatar fobermaier avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.