Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to create a new vector layer by TE

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to create a new vector layer in TE. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

In the secondary development of te, you can load a shp or spatialite file as a vector layer, and TE can also save a shp or spatialite data according to a set of spatial information, and save it in the default TE temporary file (C:\ Users\ current user name\ AppData\ Roaming\ Skyline\ TerraExplorer\ FeatureLayers). You can copy the data from this directory and use it.

The steps to create a new vector layer in TE are as follows:

1. Use the CreateNewFeatureLayer method of Creator interface in TE, where four parameters indicate that layerName is the name displayed in the information tree of fly, LayerGeomType is the spatial geometry type of the layer (point, line, face or blend), the connection string of sConnectionString layer, TEPlugName=OGR;FileName=NameOfShapeFile.shp is the connection string of shp file, NameOfShapeFile is the file name of shp, and TEPlugName=OGR FileName=NameOfSQLiteFile.sqlite;LayerName=newlayername is the connection string of spatialite, where NameOfSQLiteFile is the name of spatialite, LayerName is the layer name in spatialite, and GroupID is the parent id in the information tree.

2. After the layer is created, if the coordinate system is different from the current fly project coordinate system, set the coordinate system IFeatureLayer.CoordinateSystem.WellKnownText = wkt string of the layer.

3. The attribute information to be created in the layer needs to be created using CreateAttribute in the Attributes of DataSourceInfo. The four parameters are attribute name, attribute type, length and precision. The number and type of attributes should be determined, and when attributes are added later, they need to be added one by one in order.

4. After the attribute is created, you need to add a feature to the layer. The feature is composed of spatial information and attribute string. For example, if you add four attributes above, the attribute character should contain four elements, with a semicolon ( ) separated, the spatial information is created using SGWorld.Creator.GeometryCreator.CreateGeometryFromWKT (wkt character), and the pIFeatureGroup,pIFeatureGroup.CreateFeature (spatial information, attribute information) of the layer is obtained by using var pIFeatureGroup= pLayer.FeatureGroups [0] as IFeatureGroup;, so that a vector object can be created.

5, after the circular creation of the object, you can set some common properties of the layer, pLayer.Visibility.MaxVisibilityDistance = 1000000, visibility, and so on, then save the layer, pLayer.Save (), that is, complete the creation of the layer; layers of different coordinate systems, pLayer.Reproject = true, but also need to convert the coordinate system and refresh the operation.

This is the end of this article on "how to create a new vector layer in TE". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report