Error: The Geometry has no Z values

Source: Internet
Author: User
Tags ipoint
The Geometry has no Z values error occurred when adding map annotation to ArcGis.

The solution is as follows:

 

Public bool AddFeature (ESRI. ArcGIS. Geometry. IGeometry geometry, System. Collections. Generic. Dictionary <string, object> properties)

{

Try

{

ESRI. ArcGIS. Geodatabase. IFeature feature = _ featureLayer. FeatureClass. CreateFeature ();

 

Int index;

Index = feature. Fields. FindField ("Shape ");

IGeometryDef pGeometryDef;

PGeometryDef = feature. Fields. get_Field (index). GeometryDef as IGeometryDef;

 

If (pGeometryDef. HasZ)

{

IZAware pZAware = (IZAware) geometry;

PZAware. ZAware = true;

// IZ iz1 = (IZ) geometry;

// Iz1.SetConstantZ (0); // set the Z value to 0

IPoint point = (IPoint) geometry;

Point. Z = 0;

}

Else

{

IZAware pZAware = (IZAware) geometry;

PZAware. ZAware = false;

}

If (pGeometryDef. HasM)

{

IMAware pMAware = (IMAware) geometry;

PMAware. MAware = true;

}

Else

{

IMAware pMAware = (IMAware) geometry;

PMAware. MAware = false;

}

 

 

Feature. Shape = geometry;

Foreach (string key in properties. Keys)

{

SetFeatueProperty (feature, key, properties [key]);

}

Feature. Store ();

Return true;

}

Catch (Exception ee)

{

Return false;

}

}

 

 

There is an article on the internet, refer to: http://xxy12300.blog.163.com/blog/static/2634345820097231939796/

 

How to convert Gemetry without Z value into Geomtry with Z value in Engine: error "the geometry has no Z values"

15:19:39 | category: GIS development | font size subscription

When you use Feedback to create a new element, the obtained element does not have a Z value. If the data source (Layer Element) has a Z value, the new element fails. the error "the geometry has no Z values" is returned ". You can use the following methods to solve the problem:

// First determine whether the layer element has the Z value int index; index = pFeature. fields. findField ("Shape"); IGeometryDef pGeometryDef; pGeometryDef = pFeature. fields. get_Field (index ). geometryDef as IGeometryDef; IPointCollection pPointCollection = pgom as IPointCollection; if (pGeometryDef. hasZ) {IZAware pZAware = (IZAware) pgom; pZAware. ZAware = true; IZ iz1 = (IZ) pGeom; iz1.SetConstantZ (0); // set the Z value to 0} else {IZAware pZAware = (IZAware) pGeom; pZAware. ZAware = false;} if (pGeometryDef. hasM) {IMAware pMAware = (IMAware) pgom; pMAware. MAware = true;} else {IMAware pMAware = (IMAware) pgom; pMAware. MAware = false ;}

(Conversion) if the data source does not have the Z value but the target data source has the Z value, set. shape = B. an error occurs during Shape.

The solution is to use FME to convert data sources without element classes. The default Z value is zero. The disadvantage of this method is the trouble.

Can't I use the Engine to convert rows? Yes. However, if you directly obtain the Geometry of the data source and then forcibly assign the Z value to it (IZWare = True is not acceptable), you need to create a New Geometry Based on the Geometry of the data source, then, assign the Z value to each node.

Pay attention to two issues: when you use the Geoemtry node of the cyclic data source, you must note that the temporary variable must be long. Generally, dim I as integer is preferred, but many node data may exceed 30 thousand :)

The second issue to be noted is that the data source may be composed of multiple components, polyline may have multiple paths, and polygon may have multiple rings, take a good look at the modry Modal PDF file. If the data source has only one part, you can traverse all pointcollection's point and assign the Z value. If there are multiple parts, you will know a little experienced, this is not the case. Oh, you need to create a part.

When cutting elements, if the elements have a Z value, the same is true.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.