How do i read the Z value out of a shapefile?

Hello!
I’m trying to make a workflow to read out XYZ of an shapefile to eventualy make cogopoints, 3D polyline and a surface of the particular area of interest. Everything works fine except reading the Z value of the shapefile. Im using the ‘‘DynamoGIS’’ package to read .SHP files. Tried everything to my knowledge to resolve this problem but with no succes. I hope the power of the forums will help me out with this problem :slight_smile: As i am a new member of this forum i cant post my .dyn file here.

that looks ok to me.

I think by default, point features in shapefiles are saved as 2D (X,Y)
It may be that the elevation (z) is stored in a separate attribute. In Dynamo, hover over your Shape.GetFieldNames node- you might see something obvious like an ‘elevation’ or ‘z’ attribute

Alternatively, open the dbf file that accompanies the shp file in Excel, and you’ll see all the attributes

2 Likes

Hi thanks for your swift reply, i see where you are going with your workflow. Unfortunately, there isnt an elevation field listed in the SHP file. When i mapimport the file into civil 3D it generates an 3D polyline, so it for sure contains Z data.

Let me give you a bit of background information. We use an program called "Cyclomedia’’ to observe certain areas, the company laserscans the entire country every year. We can use this laserscanned data to make measurements, recently found out whe can export these measurements to an SHP or JSON file. Experimented a bit with the JSON data but there wasn’t a good package available to get what i needed.

The measurement is exported as ‘‘linestring’’ in the shapefile. This makes sense as there is an 3D polyline placed upon mapimporting. There got to be a way to use the Z data in dynamo. Using mapimport and then manualy using this line in dynamo is not what im looking for, becouse i would like to limit the effort to one workflow.

I hope i have given you enough information.

These are the fieldnames and values;

Did some magic moderator work on the back end. I think you can post files now.

A small shp file is likely needed for us to know how the elevation data is contained - can you share such? One single outline should do. If the magic didn’t work posting to Box, Dropbox, Google Drive, OneDrive etc. is best.

3 Likes

Dyn file down bellow;
Shapefile_3Dpolyline-en-Surface.dyn (85.2 KB)

SHP/SHX/DBF etc. etc. file link;

2 Likes

I can’t find any z info in the dataset, can you post a link to this online service, sounds pretty interesting.

2 Likes

Hi KirkWM,

I am not trying to advertise the service of the company, but im posting it becouse of you asking.
It is an subscription based service; Home page | Cyclomedia. The company is called cyclomedia, service is called Street Smart. I might contact the company to ask if they include an elevation field in the shapefile, i see no other solution for this at the moment.

yes, the issue is that your shapefile contains a single linestring feature, plus it seems that the DynamoGIS package uses a library which only deals with 2D points.

A solution would be to:

  • extract the vertices of the linestring
  • extract the z coordinates of the vertices to an attribute
  • save it as a new shapefile, and use that in Dynamo like this Points_3D.zip.txt (3.2 KB)
    You could do this in any GIS application. I used QGIS

Andrew

1 Like

Beste Johnny,

Instead of opting the SHP route you should go for the JSON file. This can be deparsed in Dynamo with just standard nodes. See attached, works for me with Cyclomedia.

HI-C-Cyclomedia import-001.dyn (117.0 KB)