Click here to Skip to main content
16,020,186 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am trying code to read LAS files in C#. When I compile the code I am getting following error:

Unable to load DLL 'liblas_c.dll': (Exception from HRESULT: 0x8007007E)


Below is my Code:



using System;
using System.Text;
using LibLAS;


class Program
{
static void Main(string[] args)
{
try
{
LASReader lasreader = new LASReader(@"d:\Bean_A.las"); //I get exception on this line

LASPoint laspoint;

LASHeader lasheader = lasreader.GetHeader();
Console.WriteLine(lasheader.SoftwareId);//
lasheader.VersionMinor = 0;
LASWriter laswriter = new LASWriter(@"c:\las\sample_our.las", lasheader, LASReadWriteMode.LASModeWrite);

Console.WriteLine("Number of points in file= {0}", lasheader.PointRecordsCount);

while (lasreader.GetNextPoint())
{
laspoint = lasreader.GetPoint();
laspoint.X = laspoint.X + 3;

//Console.WriteLine(laspoint.X + "," + laspoint.Y + "," + laspoint.Z);

laswriter.WritePoint(laspoint);
}
}
catch (LASException e)
{
Console.WriteLine("\nLASException! Msg: {0}", e.Message);
}
catch (SystemException e)
{
Console.WriteLine("\nException! Msg: {0}", e.Message);
}
catch
{
Console.WriteLine("Unknown exception caught");
}
finally
{
Console.WriteLine("Do i need something to do?");
}
Console.WriteLine("End of file");
Console.Read();
}
}



This code is provided at liblas site.


I am using following:

Visual studio 2013

Windows 7 64 bit



Solutions I tried, but not working:

1. Copied .dll file inside system32 folder

2. Changed project platform to x86

3. Dependency tool



Any other solution to solve this error? or is there any other library available to read LASER .LAS files data?

Thanks,
Jagzy
Posted
Comments
ZurdoDev 8-Oct-15 8:48am    
Put it in the bin folder of your app.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900