I have been playing with the API in VB.net and can not get a geometry from the GetGeometry() function.
According to the C# examples:
PointShapeBuffer pointGeometry = row.GetGeometry();
point = pointGeometry.point;
In Vb.net the GetGeometry function explicity states it returns a ShapeBuffer. It will not accept a CType converstion to PointShapeBuffer, and will not accept a PointShapeBuffer as an output. The Help states the Geometry function returns a ShapeBuffer so I do not understand how to get a point from (Get)Geometry function.
Any advice would be appreciated.
David
Anyone still having problems with this in VB.Net? I ran on to the same problem with version 1.4 as well as 1.5. I wrote a C# DLL with some "Get Geometry" functions to deal with all the buffer types. One point to note is that when the new geometry is returned, it still shows as a ShapeBuffer in debugging, but you can still access the PointShapeBuffer, MultiPointShapeBuffer, MultiPartShapeBuffer, MultiPatchShapeBuffer properties regardless. I hope this helps someone:
Usage:
Imports ESRIFileGDB.ConvertShapeBuffer
.
.
.
Dim geometry As New PointShapeBuffer = GetPointGeometry(row)
----------------------------------------------------------------------------------------------------------
ESRIFileGDB.cs
===============================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Esri.FileGDB;
namespace ESRIFileGDB
{
public class ConvertShapeBuffer
{
public ConvertShapeBuffer()
{
}
public static PointShapeBuffer GetPointGeometry(ref Esri.FileGDB.Row shapeRow)
{
try
{
PointShapeBuffer pointGeometry = shapeRow.GetGeometry();
return pointGeometry;
}
catch
{
return null;
}
}
public static MultiPointShapeBuffer GetMultiPointGeometry(ref Esri.FileGDB.Row shapeRow)
{
try
{
MultiPointShapeBuffer multipointGeometry = shapeRow.GetGeometry();
return multipointGeometry;
}
catch
{
return null;
}
}
public static MultiPatchShapeBuffer GetMultiPatchGeometry(ref Esri.FileGDB.Row shapeRow)
{
try
{
MultiPatchShapeBuffer patchGeometry = shapeRow.GetGeometry();
return patchGeometry;
}
catch
{
return null;
}
}
public static MultiPartShapeBuffer GetMultiPartGeometry(ref Esri.FileGDB.Row shapeRow)
{
try
{
MultiPartShapeBuffer multipartGeometry = shapeRow.GetGeometry();
return multipartGeometry;
}
catch
{
return null;
}
}
}
}
===========================================================