0

I have a binary file "geo.bin" that represents some geometry (OGR WKB I think). The binary file has a list of points that make up a polygon. I'd like to read the binary data and create an array of points in my VBScript script.

Are there solutions that already exist I can leverage? Perhaps a .NET class like DbGeometry? If so how would I instantiate such a class? I have tried the following but get an error "ActiveX component can't create object: 'GetObject'":

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")

Dim logfile
Set logfile = fso.CreateTextFile("A:\Atoll\geotest.log")

'read binary geometry into byte array
Dim stream, bytes
Set stream = CreateObject("ADODB.Stream")
stream.Open
stream.Type = 1
stream.LoadFromFile("A:\Atoll\geo.bin")
bytes = stream.Read
stream.Close

Dim dbgeo: Set dbgeo = GetObject("C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.Entity.dll", "DbGeometry")
logfile.Write(TypeName(dbgeo) & vbCrLf)

Dim poly: Set poly = dbgeo.FromBinary(bytes)

I've also tried using:

Dim dbgeo: Set dbgeo = CreateObject("System.Data.Spatial.DbGeometry")

But get a similar error.

carlr
  • 21
  • 5
  • 2
    VBScript cannot use .Net classes unless they expose a COM interface. Use PowerShell instead. – Ansgar Wiechers Mar 04 '17 at 20:55
  • Unfortunately in this instance I'm forced to use VBScript. I will look into executing a Powershell script from VBScript. That should work so long as I can get the PS script to return data to my VBScript script. – carlr Mar 04 '17 at 21:15
  • 1
    You might be able to interpret the data with VBScript as well, but AFAIK there's nothing ready-made for VBScript, so you'll have to do implement it yourself. You need to provide information about the source and destination formats if you want us to help with that. – Ansgar Wiechers Mar 04 '17 at 22:34

0 Answers0