While reader.ReadNext() Dim geometry as MgGeometry = agfReader.Read(reader.GetGeometry(myLayer.FeatureGeometryName)) Dim propcol As MgPropertyCollection = new MgPropertyCollection() Select Case geometry.GeometryType
Case MgGeometryType.MultiPolygon i = 0 tempString = Nothing collOfCoord.Clear() Dim multiPolygon As MgMultiPolygon = TryCast(geometry, MgMultiPolygon) Dim coordIterator as MgCoordinateIterator = multiPolygon.GetCoordinates() While coordIterator.MoveNext() Dim multiPolyCoord As MgCoordinate = coordIterator.GetCurrent() CollOfCoord.Add(MultiPolyCoord) End While
I have code to recognize which type of geometry preseneted on map. For every geometry on this map exists ID, LAYER_ID and so on... I'd like to know is there any way to get these properties(ID, LAYER_ID...) for current geometry?
While reader.ReadNext() Dim geometry as MgGeometry = agfReader.Read(reader.GetGeometry(myLayer.FeatureGeometryName)) Dim propcol As MgPropertyCollection = new MgPropertyCollection() Select Case geometry.GeometryType
Case MgGeometryType.MultiPolygon i = 0 tempString = Nothing collOfCoord.Clear() Dim multiPolygon As MgMultiPolygon = TryCast(geometry, MgMultiPolygon) Dim coordIterator as MgCoordinateIterator = multiPolygon.GetCoordinates() While coordIterator.MoveNext() Dim multiPolyCoord As MgCoordinate = coordIterator.GetCurrent() CollOfCoord.Add(MultiPolyCoord) End While
I have code to recognize which type of geometry preseneted on map. For every geometry on this map exists ID, LAYER_ID and so on... I'd like to know is there any way to get these properties(ID, LAYER_ID...) for current geometry?
Hello,
here is an example of reading feature properties (sorry I write in C#, you can translate it to VB online):
//Get feature service
MgFeatureService featureService = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as MgFeatureService;
//Get class definition for class name
MgClassDefinition clDef = featureService.GetClassDefinition(resource, schemaName, className); MgPropertyDefinitionCollection classPropeties = clDef.GetProperties();
MgFeatureReader reader = featureService.SelectFeatures(resource, className, query);
while(reader.ReadNext())
{
foreach (var property in classPropeties)
{
string propertyName = property.Name;
//for data properties
if(property.GetPropertyType() == MgFeaturePropertyType.DataProperty)
{
var propDef = property as MgDataPropertyDefinition;
var propType = propDef.GetDataType();
switch (propType)
{
case (MgPropertyType.Int16):
Int16 prop16 = reader.GetInt16(propertyName);
break;
case (MgPropertyType.String):
Int32 prop32 = reader.GetInt32(propertyName);
break;
//etc.
}
}
//for geometry property
else if (property.GetPropertyType() == MgFeaturePropertyType.GeometricProperty)
{
var geomProp = property as MgGeometricPropertyDefinition;
var geomType = geomProp.GeometryTypes;
switch (geomType)
{
case (MgGeometryType.Polygon):
//your code
break;
//etc.
}
}
} }
Hope it hepls.
Hello,
here is an example of reading feature properties (sorry I write in C#, you can translate it to VB online):
//Get feature service
MgFeatureService featureService = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as MgFeatureService;
//Get class definition for class name
MgClassDefinition clDef = featureService.GetClassDefinition(resource, schemaName, className); MgPropertyDefinitionCollection classPropeties = clDef.GetProperties();
MgFeatureReader reader = featureService.SelectFeatures(resource, className, query);
while(reader.ReadNext())
{
foreach (var property in classPropeties)
{
string propertyName = property.Name;
//for data properties
if(property.GetPropertyType() == MgFeaturePropertyType.DataProperty)
{
var propDef = property as MgDataPropertyDefinition;
var propType = propDef.GetDataType();
switch (propType)
{
case (MgPropertyType.Int16):
Int16 prop16 = reader.GetInt16(propertyName);
break;
case (MgPropertyType.String):
Int32 prop32 = reader.GetInt32(propertyName);
break;
//etc.
}
}
//for geometry property
else if (property.GetPropertyType() == MgFeaturePropertyType.GeometricProperty)
{
var geomProp = property as MgGeometricPropertyDefinition;
var geomType = geomProp.GeometryTypes;
switch (geomType)
{
case (MgGeometryType.Polygon):
//your code
break;
//etc.
}
}
} }
Hope it hepls.
Can't find what you're looking for? Ask the community or share your knowledge.