State GIS Shape file error

State GIS Shape file error

akeyXHWHT
Enthusiast Enthusiast
5,177 Views
24 Replies
Message 1 of 25

State GIS Shape file error

akeyXHWHT
Enthusiast
Enthusiast

I have a contour shape file I created in QGIS from New York State GIS data.  I have used the method before that has been well described in this forum in the past.

 

1) Map import the shape file

2) Open a new drawing and query the elevation object data from the first drawing using the Mapwspace tool.

3)  Tell it which object data is the elevation and execute and then all your polylines have their elevation changed to the object data elevation for each line.

4) Create your surface from there and proceed as necessary.

 

This has worked several times for me in the past.

 

Howerever, this time the process fails because instead of the elevation of the object data being a just a number in that database cell, it's a number then ft after.  So mapimport can't create a surface from GIS data because it doesn't understand the elevation data.  And the mapwspace query doesn't work either for the same reason.

 

So I tried to edit the database dbf file directly with open office calc, as many people on this forum have already described.  I can open the database and remove "ft" from all the cells so the elevation column is just the number, but when I try to save the file I get an error that the shape length column has cells with more than 19 digits and 15 digits after the decimal.  Even if I try to format that column so it is less than 19 characters I still get an error and it won't let me save.

 

If I try to open the data base in excel and make the change, civil 3d shows an error that the database is corrupt or the entries in the dbf file don't match the shp file.

 

Any ideas?

 

 

0 Likes
Accepted solutions (2)
5,178 Views
24 Replies
Replies (24)
Message 2 of 25

Pointdump
Consultant
Consultant

@akeyXHWHT,
"...a contour shape file I created in QGIS from New York State GIS data."
More details please on what you got and what you did in QGIS. Can you post a link to your New York Data?

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 3 of 25

akeyXHWHT
Enthusiast
Enthusiast

I downloaded the Lewis county contour zip file found here

 

http://gis.ny.gov/elevation/contours/contours-lewis.htm

 

Then I opened that file in QGIS and turned on the layer Lewis_County_Contours Town_DenamrkUSDA_Contours_2ft

 

From there I right clicked the layer and went down to export and exported- save feature as and saved it as an esri shape file with the coordinate system set as New York Central Foot.  All the object data was checked to be included in the export.

 

I won't let me attach that shape file here.  It says the content type doensn't match its file extension. It will let me attach the dbf file.

 

That shape file looks great in Civil 3d and it qeo-references exactly as it should.  All the data is there and in the proper fields.  It's just the elevation data is listed in each cell as 798 ft instead of just 798.  

 

 

0 Likes
Message 4 of 25

Pointdump
Consultant
Consultant

The Forum will accept anything zipped up to 71MB. That's best for shapefiles anyway. Keeps everything together.
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 5 of 25

Pointdump
Consultant
Consultant

I'm having a hard time downloading the Lewis County Contours. Clicked on "Contour Zip File" about a hundred times without success.
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 6 of 25

akeyXHWHT
Enthusiast
Enthusiast

I'll zip them up now.  

 

As far as the download...I guess Chrome and Edge browser have all disabled downloading zip files.  It's happened within the last couple weeks.  You have to use firefox or internet explorer.  I just got firefox yesterday.  You can also download the files directly with an ftp client.

0 Likes
Message 7 of 25

akeyXHWHT
Enthusiast
Enthusiast

Here is the zip file of my shape file and the supporting documents.

0 Likes
Message 8 of 25

Pointdump
Consultant
Consultant

OK, thanks for the tip on Browsers. I downloaded Firefox and grabbed the contours directly. I see why you needed QGIS to convert the GDB Contours into a Shapefile. I also see the "ft" appended. I think even if you remove the "ft", it's still a string variable and needs to be an integer. Might be able to use an expression when you query them in. I'll check a few things.
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 9 of 25

hippe013
Advisor
Advisor

I have a lisp that I've written that converts flat polylines, imported in by mapImport, and applies the elevation to the polyline. I've tested it with your contours and it works fine. It looks at the elevation field of your choosing and is able to drop and ignore the "ft" in the field value. Let me know if that would help.

0 Likes
Message 10 of 25

akeyXHWHT
Enthusiast
Enthusiast

That would be awesome. I haven’t learned to write a lisp yet.  I’m just getting back in to CAD for a new job after about a 15 year absence. I’m getting up to speed quickly but it’s all still through a firehose. When I’m not looking up new things every day I’ll start to learn about Lisps. 

0 Likes
Message 11 of 25

Pointdump
Consultant
Consultant
Accepted solution

In QGIS I was able to use a Substring expression to remove the "ft". Now after a query the elevations are useful for making a surface.
Then I was nosing around and remembered I posted the same question >>>Here<<<. (Every day is a new day around here.)
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
Message 12 of 25

akeyXHWHT
Enthusiast
Enthusiast

This is awesome!  Thanks so much. Can’t wait to try it when I get back to the office tomorrow. 

0 Likes
Message 13 of 25

АлексЮстасу
Advisor
Advisor

Similar to the proposed hippe01 - with the help of a ready-made OD2DXF38.lsp from CADaSchtroumpf, you can immediately after MAPIMPORT, without changing the field type, leaving "ft," in about 3 minutes give all polylines a Elevation based on the value from the ELEVATION field.


But before that, you need to replace the Lines primitives with Polylines with OD preservation. (For example, MAPCLEAN).

 

How to use lisp:
1. Download lisp file - APPLOAD.
2. Enter command at the command prompt. (For example, OD2DXF38).

3. Perform the actions required by this lisp.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 14 of 25

akeyXHWHT
Enthusiast
Enthusiast

Dave,

  the define object data dialog box worked perfectly. so simple and easy.  Thanks again!!

 

Austin

Message 15 of 25

ChicagoLooper
Mentor
Mentor
Accepted solution

The MAPIMPORT command works on the contour shapefile you uploaded but the Object Data created during the import procedured  is baffling. Here's why. After you've imported the contours with the object data, you'll notice the OD fields NAME and ELEVATION have the same elevation values and the suffix 'ft.' Intuition says both fileds will behave the same but they don't. While the OD field NAME is editable the OD field ELEVATION is not (at least I couldn't edit it).

 

Here's a procedure that will allow you to use the NAME field to move your contours to their proper elevtion. Judging from your opening post it sounds like you already know most of it so this should be a breeze. 

  1. Change your workspace to Planning & Analysis. Assign a coordinate system to modelspace then use MAPIMPORT to import your shapefile. Create Object Data during this import operation.
  2. When the line work finally appears, go to Map Setup Tab=>Attribute Data Panel=>Define Object Data Button.
  3.  In the next window, make sure Denamrk_2_foot_contours appears in the dropdown of Table Section. Click the MODIFY button toward the bottom window.
  4. In the next window, click NAME in Object Data Fields section. When NAME appears in the box named Field Name, change TYPE from Character to Integer then click UPDATE, then click OK. Be patient and wait while the data is updated. It may take a minute or two to change the OD type from character to integer.
  5.  When the process is completed, you'll be returned to the Define Object Data window. Click CLOSE to exit.  
  6. Back in modelspace, click an individual contour and review the OD in the Properties Palette. The OD Name will be an integer without the ft suffix. You can now run your QUERY using the field NAME to alter the properties of your contours and raise them to their proper elevation.

NOTES:

The above solution is in contrast to other procedures offered on the forum because it changes the Object Data itself and not the shapefile's database file (dbf). This eliminates the harm typically caused when a dbf is edited for personal benefit. 

 

While thrid party programs can be used this procedure is an exception--it uses Civil3D exclusively. No lisp was needed nor used.

Chicagolooper

EESignature

Message 16 of 25

Pointdump
Consultant
Consultant

@ChicagoLooper,
"Intuition says both fields will behave the same but they don't. While the OD field NAME is editable the OD field ELEVATION is not (at least I couldn't edit it)."
I didn't have any problem editing the ELEVATION Field. I even used both in my Query Expression. I guess if NAME and ELEVATION Fields contained different numbers, there would have been problems.

 

Contours_4.png

 

Contours_5.png

 


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 17 of 25

АлексЮстасу
Advisor
Advisor

If there is a purpose not to use lisp, then it is understandable.
But here lisp (from hippe01, from CADaSchtroumpf) gives a significant saving of time and action, and the possibility of errors in imperfect actions is excluded.

 

1. No "ft" delete actions are required. You do not need to work in QGIS or change the field type in OD. The original data is saved completely.
2. You do not need to make a query to assign Elevation, get a new file, attach, detach, close, open files, etc.
3. Everything is done in the active file immediately after MAPIMPORT in one action.

Elevation_ft.png


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 18 of 25

Pointdump
Consultant
Consultant

Alexander,
"...you need to replace the Lines primitives with Polylines with OD preservation."
More detail on that please. How would you go about doing that? And aren't contours already polylines?
"If there is a purpose not to use lisp, then it is understandable."
I don't use lisp because I don't understand them. Not at all. And I don't even know where to go to learn about them. Same with VBA, Dynamo, SAC, etc. If something can be done completely in Civil/Map, that's how I do it. Second option is 3rd party software, like QGIS, Geoviewer, etc.
The only time I ever used a lisp was to explode anonymous blocks. There was no other way. And I had to Google search to learn how to "load" it into AutoCAD.
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 19 of 25

АлексЮстасу
Advisor
Advisor

@Pointdump wrote:

"...you need to replace the Lines primitives with Polylines with OD preservation."
More detail on that please. How would you go about doing that? And aren't contours already polylines?


You can convert Lines to Polylines by MAPCLEAN saving the OD. In the Cleanup Methods tab, select Line to Polyline.
Yes, there are Lines after import. You can get rid of most by selecting the Dissolve Pseudo Nodes action - merge with polylines.

Line2Pline.png
But your skepticism is partly justified. For example, OD2DXF38.lsp from CADaSchtroumpf will not give a Line height. And Map will raise Line.

 


@Pointdump wrote:

I don't use lisp because I don't understand them. Not at all. And I don't even know where to go to learn about them.


It doesn't hurt. 🙂
See 13.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 20 of 25

TerryDotson
Mentor
Mentor

Thanks for the example file, that helped us improve our PolyContour ShapeFile Import.

0 Likes