GithubHelp home page GithubHelp 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

dependabot[bot] avatar fobermaier avatar mrbeee avatar rhuijben avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sharpproj's Issues

Cannot add NuGet package to a .NET project

Hi,

I would like to test this project as an alternative to ProjNet. It looks quite impressing. However, I don't seem to be able to add SharpProj NuGet package to any .NET project. I tried a couple of versions of .NET Framework but it always gives me the following error message:

Could not install package 'SharpProj.Core 8.1.26'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I tried .NET Framework 4.5, 4.6, 4.7.2 and 4.8. I also tried .NET 5 but no luck. Can you please advise what .NET Framework is the package set up with? I checked the .DLL in the package and it seems to be built for .NET Framework 4.6 but adding it via NuGet still fails.

Thanks,
Pavel

FileNotFoundException in .net 6

Hi!

I want to use SharpProj.NetTopologySuite and i included the SharpProj and SharpProj.NetTopologySuite Nuget Packages in my .net 6 Project.
At runtime i get System.IO.FileNotFoundException Could not load file or assembly 'SharpProj, Version=8.2001.128.0, Culture=neutral, PublicKeyToken=3a930e679d9a0873'.

What am i doing wrong?

SharpProj for platform target x64

Hi.
I'm trying to use this library in an ArcGIS Pro Add-in. The ArcGIS Pro SDK supports only x64, and I'm not able to use this library now. I first got the FileNotFoundException mentioned in #25 and after adding

<ItemGroup> <Content Include="$(NetCoreTargetingPackRoot)\Microsoft.NETCore.App.Host.$(NETCoreSdkRuntimeIdentifier)\$(BundledNETCoreAppPackageVersion)\runtimes\$(NETCoreSdkRuntimeIdentifier)\native\ijwhost.dll" Link="ijwhost.dll"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup>

and

<PropertyGroup> <UseIJWHost Condition="'$(TargetFramework)' == 'net8.0'">true</UseIJWHost> </PropertyGroup>

I now get an error saying

System.BadImageFormatException: Could not load file or assembly 'C:...\net8.0\runtimes\win-x64\lib\netcoreapp\SharpProj.dll'. Format of the executable (.exe) or library (.dll) is invalid.

Does SharpProj support x64, or are you going to add this support any time soon?

Unable to use nuget package due to load error

When trying to run an app with this nuget package, I receive the following error: System.BadImageFormatException: 'Could not load file or assembly 'SharpProj, Version=8.2001.106.0, Culture=neutral, PublicKeyToken=3a930e679d9a0873'. An attempt was made to load a program with an incorrect format.'

I'm using the package in a small console application. It is .Net 5

I have tried version 8.2001.106.0 down to 8.1.26...

FileNotFoundException SharpProj.dll for Microsoft.NET.Sdk.Web

We have SharpProj working in unit test and console .net6 projects using Microsoft.NET.Sdk

When we try to run it in an api using Microsoft.NET.Sdk.Web then we get the following error (even though the dll is found in the same place in bin as the console app.

Could not load file or assembly 'SharpProj, Version=9.2000.234.0, Culture=neutral, PublicKeyToken=3a930e679d9a0873'. The system cannot find the file specified.

looking at the output pane in VS can see this:

Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll

Copying the appropriate dll using post build scripts does not work either, or forcing ijwhost.dll.

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.