Select to view content in your preferred language

get the coordinates from a shapefile

1203
3
Jump to solution
10-10-2023 02:14 AM
Labels (2)
TQGiser
Emerging Contributor

Hi,all!

I made a ShapefileFeatureTable like this:

m_table1 = new ShapefileFeatureTable("E:/test/tp2.shp")(tp2 is a polyline shapefile);

i can use m_table1->extent().xMax() know the evelope's x,y coords;

but when i want to know the x,y coord of the point which explode by the polylineshapefile,

i dont know how to work with it,

Just like the function in ArcPy:

arcpy.da.SearchCursor(polyLineShapeFile, ['SHAPE@X', 'SHAPE@Y', 'SHAPE@M'], explode_to_points=True)

thans a lot!!

 

0 Kudos
1 Solution

Accepted Solutions
TQGiser
Emerging Contributor

Hi,all,i have figure out!😀

TQGiser_0-1697457122339.png

 

View solution in original post

0 Kudos
3 Replies
LucasDanzinger
Esri Frequent Contributor

First thing to do after creating the shapefile feature table is to query it for the feature you want, using the query parameters - https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-featuretable.html#queryFeature...

 

Once you have the Feature handy, you can get the feature's geometry https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-feature.html#geometry

 

Once you get the geomtry, you'll need to use geometry_cast to cast the base class Geometry to a Polyline.

 

The Polyline is-a Multipart geometry. You'll want to go through the parts, and for-each  part, you can get a list of the points/vertices that make up the part https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-immutablepart.html#points

 

Hope this helps!

0 Kudos
TQGiser
Emerging Contributor

Thank you for the suggestion,but it do not work😂

In the api reference,the offical mathord is QFuture<*>:

TQGiser_0-1697422727773.png

and i tried like this:

TQGiser_1-1697422919183.png

the resault is:

TQGiser_2-1697422951286.png

seems like i have got the Geometry,

but the FeatureQueryResult has not function to get the geometry point list😂

so,what can i do 

0 Kudos
TQGiser
Emerging Contributor

Hi,all,i have figure out!😀

TQGiser_0-1697457122339.png

 

0 Kudos