- Home /
Using GDAL from Unity
Hello,
I want to read a raster map from my Unity application. I planned to use Geospatial Data Abstraction Library(GDAL) for this task. This is a C++ library but it has a C# wrapper which handles C++ calls. I tried to use its C# wrapper from the unity. However, I could not achieve. Finally, I got the error below:
Failed to load 'Assets/GDAL/gdal_wrap.dll' with error '%1 is not a valid Win32 application. ', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly. GameController:Start() (at Assets/Scripts/GameController.cs:58) GameController:Start() (at Assets/Scripts/GameController.cs:15)
Is there anyone who achieved to use GDAL from Unity? Or, is there anyone who read raster map from Unity application? If yes, how? I am waiting for help.
Thanks...
Did you get in running in the end? I'm desperately looking for a framework that will help me with projection math and will play nicely with unity. What did you use?
@studiomaurer Proj.NET works fine if you just need standard projection functions
I also had success with Proj.Net for geospatial coordinate conversions in Unity.
I looked around the net and found this tutorial on using in on a non Unity project. $$anonymous$$aybe you can adapt it to Unity:
http://vipassanaandenvironmentalinformatics.blogspot.de/2013/03/getting-started-with-c-and-gdal.html
Answer by chmodseven · Sep 12, 2019 at 03:32 AM
In case it helps anyone, here's the steps I followed:
Navigate in your browser to https://www.gisinternals.com/
Download stable x64 version (e.g. I got release-1911-x64-gdal-3-0-0-mapserver-7-4-0.zip) and unpack to a folder. This assumes you are using 64-bit build. For 32-bit there's an x86 version available instead, but I haven't tried it.
Create a Plugins/GDAL folder under your Assets folder in Unity
In unpacked folder, go to bin/ and copy any .dll file to Assets/Plugins/GDAL folder
Go to bin/gdal/csharp/ and copy any .dll file to Assets/Plugins/GDAL folder
Go to bin/ms/csharp/ and copy any .dll file to Assets/Plugins/GDAL folder
And that should pretty much do it.
No further input from me, just a quick note of thanks for your follow-through here.
Your answer
Follow this Question
Related Questions
Assigning UV Map to model at runtime 0 Answers
Package manager for 3rd party libraries. 0 Answers
Need Advice on Direction for Apps 0 Answers
How to get Unity to detect my own touch events 0 Answers
A total newb here need help! 0 Answers