Loss of attributes when importing Shapefiles

Loss of attributes when importing Shapefiles

samoh21
Contributor Contributor
6,418 Views
21 Replies
Message 1 of 22

Loss of attributes when importing Shapefiles

samoh21
Contributor
Contributor

Hi

 

Followings happens:

 

I import GIS contours as shapefile, where the elevation is shown as attribute.

After the import, some polylines are missing their attribute?

 

I have checked the GIS contours through data connection, (SHP) and i can see all the attributes.
I have tried to import the shapefile several times, and it appears to be random each times which polylines that have no attributes

 

What can it be?

 

3D_View.PNGSHP_import.PNG

0 Likes
Accepted solutions (1)
6,419 Views
21 Replies
Replies (21)
Message 2 of 22

Todd_Rogers
Mentor
Mentor

Why not create a Civil 3D surface from GIS data? If you go to Surfaces, there is an option under there for Create Surface from GIS Data.

Todd Rogers
Civil Administration
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 3 of 22

Ranjit_Singh
Advisor
Advisor

If you have permission to share the shape file then upload the shp file. It will be helpful in understanding the issue.

PS: If shp doesn't upload then zip the file before uploading.

0 Likes
Message 4 of 22

Anonymous
Not applicable

I don't have shapefile data to test at the moment, so this is all from memory.

 

When importing a shapefile, there should be an option to place the line at elevation defined by attribute, then you select what  attribute sets the elevation.

 

The properties your looking at are the geometric properties of the line, what elevation the line physically sits at.

 

when you import a shapefile with attributes, I THINK, the attributes that come with it are displayed on one of the other tabs of the properties window (Extended Data maybe.)

 

So, if you poke around the other tabs, and find the elevation attribute with the correct data, but don't have the lines sitting at the right elevation in space, I'd look for the import at elevation option on the import dialog.

 

Now, if this WAS the answer, I'd expect all contours to come in at 0 elevation. If the data was imported correctly, no idea why only some would be at the proper elevation.

 

 

0 Likes
Message 5 of 22

jmayo-EE
Mentor
Mentor

https://knowledge.autodesk.com/support/autocad-civil-3d/troubleshooting/caas/sfdcarticles/sfdcarticl...

 

This workflow is the same as it was before Civil 3D was even thought of.

John Mayo

EESignature

0 Likes
Message 6 of 22

samoh21
Contributor
Contributor

@jmayo-EE I have used the same work flow,

 

But the problem it is when i import the shapefiles with the data, not all the attributes comes along wtih the polylines.

 

i have uploaded the files, maybe you could try.

 

 

 

0 Likes
Message 7 of 22

Joe-Bouza
Mentor
Mentor
Are you selecting all the attributes to import?

I'm with Tim. If your end result is a surface, make it directly from gis

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 8 of 22

Joe-Bouza
Mentor
Mentor
I meant Todd. Why do I get you two mixed up?

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 9 of 22

Pointdump
Consultant
Consultant

Samoh,

 

Your attachment has only the SHP file. Also needed are the SHX, DBF, and PRJ files.

 

Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2027
0 Likes
Message 10 of 22

jmayo-EE
Mentor
Mentor

FYI, I also agree w/ a GIS workflow.

 

With most public data I have used, contours rarely if ever import from a shp file with elev's assigned to the plines and I have always had to run the query (see 2nd part in link above) to assign the contou elev.

 

Did you perform the query correctly?

John Mayo

EESignature

0 Likes
Message 11 of 22

AllenJessup
Mentor
Mentor

I would think that if some of the attributes are missing. That might be a problem with the original GIS files. If you post the files @Pointdump mentioned. We can confirm that.

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 12 of 22

samoh21
Contributor
Contributor

Thanks guys,

 

I should have attached all the files now, its only the xrefs to th SHP.
SHP is attached before.

 

The contours are in 10x10 km, and have added a dwg with the area of the contours i have problems with.

 

0 Likes
Message 13 of 22

Joe-Bouza
Mentor
Mentor

<>.rar? how bout a regular zip file? I know i'm not downloading a trojan to see what you have.

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 14 of 22

AllenJessup
Mentor
Mentor

@Joe-Bouza

 

I tried zipping it but It's too large to post. We have goo AV software and it let the RAR past. Up to you if you open it or not.

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 15 of 22

Joe-Bouza
Mentor
Mentor

@AllenJessup are you the OP too? I was responding to the op, I meant no ill, just dont like those sites for down loads.

 

What does that mean go AV and let rar past?

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 16 of 22

AllenJessup
Mentor
Mentor

@Joe-Bouza wrote:

@AllenJessup are you the OP too?

 

What does that mean go AV and let rar past?


No. Just trying to help the OP. I noticed that their responses take some time. So I thought I could provide a Zip after "UnZipping" the RAR.

 

Bad typing. Should be Good Anti-Virus. I decompressed the RAR and the AV had no complaints. It scans every file as it's created. I'm thinking the OP used the RAR format to get past the size limit.

 

I brought the SHP into a new drawing and tried querying it. But it's been running for a half an hour. So I have to kill it and move on. I'll try again during lunch.

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 17 of 22

AllenJessup
Mentor
Mentor

OK. Now I need to know which Data Field contains the elevation. Looking at them I thought only HOEJDE made sense. But when I query the area within the rectangle defined in your drawing. Every contour has an elevation.

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 18 of 22

tcorey
Mentor
Mentor

I imported your shp file using MapImport (in Civil 3D 2018). I wrote the following code to find any polylines that do not have HOEJDE (elevation) attribute. None were found. This routine also moves your polylines to the elevation captured from the HOEDJE attribute value. You can change the _Tims layer name in the code to whatever you want, but be sure the layer exists before you run the code.

 

					;find polyline of 0 elevation in attribs or nil HOEJDE on special layer
(vl-load-com)

(defun c:go ( / ccmdecho cmenuecho ls len ctr pl recno z)
  (setq ccmdecho (getvar "CMDECHO")
	cmenuecho (getvar "MENUECHO")
	)
  (setvar "CMDECHO" 0)
  (setvar "MENUECHO" 0)

  (setq	ls  (ssget "x" (List (cons 0 "LWPOLYLINE")))
	len (sslength ls)
	ctr 0
  )
  (while (< ctr len)
    (setq pl	(ssname ls ctr)
	  recno	(ade_odgetrecord pl "REFERENCEKURVE0_25" 0)
	  Z	(ade_odgetrecfield recno "HOEJDE")
    )
    (cond ((= z nil)
	   (vl-cmdf "Change" pl "" "P" "La" "_Tims" "") ;change _Tims to your layer. Be sure it exists.
	   )
	  ((= z 0)
	   (vl-cmdf "Change" pl "" "P" "la" "_Tims" "")
	   )
	  ((> z 0)
	   (vl-cmdf "Change" pl "" "P" "E" z "")
	   )
	  )
    


    
    (setq ctr (1+ ctr))
    (prompt
      (strcat "\n" (rtos ctr 2 0) " polylines processed...")
    )
  )
  (setvar "CMDECHO" ccmdecho)
  (setvar "MENUECHO" cmenuecho)
  (princ)
)



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 19 of 22

Joe-Bouza
Mentor
Mentor

I gotcha.

 

from lack of response I assume the surface from GIS is not working for some reason?

Joe Bouza
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 20 of 22

AllenJessup
Mentor
Mentor

Joe-Bouza wrote:

 

from lack of response I assume the surface from GIS is not working for some reason?


It wouldn't work for me. No idea why. After selecting the SHP file the Next button remained greyed out. Tried three times with the same results.

Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes