Civil engineering feature implementation (Transportation Engineering)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Civil engineering feature implementation (Transportation Engineering)

Post by Joel_graff »

NOTE: This is the support / development thread for the 'Trails' workbench.

You can find it at: https://github.com/joelgraff/freecad.trails

--------

I'm starting this thread to document a more formal roadmap / approach to implementing civil engineering features in FreeCAD. It's built upon the rather extensive civil engineering thread located here:

https://forum.freecadweb.org/viewtopic.php?f=8&t=6973

As a professional transportation engineer in the US, my experience is focused on US state and federal highway design policies and practices. I've also had significant experience with Bentley Microstation / OpenRoads, which is currently the parametric CAD package being used by most US state Departments of Transportation (DOTs) to design and construct highways in 3D.

That said, I think it's important to ensure that the roadmap we build here generalizes well to other domains - whether it be transportation engineering in other countries or to other engineering disciplines that can benefit from 3D CAD.

That said, I've had discussions with microelly2 and others in the other thread about where to begin with FreeCAD. Some work has already been done, but at this point, the first key task appears to be building horizontal and vertical geometry (alignments) that we can then use to extrude highway typical sections (most likely designed in the sketcher workbench). These alignments are defined with specific elements that must be accommodated for engineering design purposes. A couple good examples of what horizontal and vertical control look like can be found here:

https://goo.gl/images/E5wXiA (horizontal)

and here:

https://goo.gl/images/BHM05Z (vertical)

This, at least, seems a starting point. I'd like to have a clearer idea of what features should be initially targeted for an initial implementation. I certainly have my own ideas, but I lack a full understanding of FreeCAD at this point and likely, I have some wrong-headed ideas that just won't work.
Last edited by Joel_graff on Mon Apr 15, 2019 1:13 pm, edited 2 times in total.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation

Post by microelly2 »

So let's start.
I think having some test data to see the models is a good starting point.
I will add a method to the geodata wb to extract the known infrastructure along a defined path from open street map.
elevation data for the terrain we get in a first step from google maps.
I will use the data for the A73 (https://www.google.de/maps/place/A73) with a lot of tunnels and bridges through the Thuringian Forest.
https://youtu.be/Hr389C4Z3EU
https://youtu.be/V3lpzc-Owj8
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation

Post by Joel_graff »

The thought occurred to me to include this:

http://gis.iu.edu/datasetInfo/statewide/in_2011.php

It's a link to the State of Indiana's Spatial Data Portal. They provide Lidar data files (DEM and LAS formats) for the entire state. That's the only resource like that in the US that I'm aware of, anyway.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation

Post by microelly2 »

okay, I can read the data with my ast importer to get elevation grids.

I still have to learn what the filenames mean - the task for sunday evening
https://spatialdata.iu.edu/DOQQS/state/ ... 2inch_spw/
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Civil engineering feature implementation

Post by Joel_graff »

Yeah, I took a look at it and wondered myself. I did download the 2013 metadata zip file, which should have described that, but in my brief review, I didn't really find any helpful clues - it did contain a lot of GIS files, I think.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation

Post by microelly2 »

bp_495.png
bp_495.png (72.85 KiB) Viewed 26002 times
It works fine, still the question where is 500 000/1272 000 in lon lat coordinates :?:
I want to check the data against google maps.

I download and unzip the files then run the script
gdal is required.

Code: Select all

# https://spatialdata.iu.edu/DOQQS/inmap05/elev/dem_tif_stpl_e/0504/
# https://spatialdata.iu.edu/DOQQS/inmap05/elev/dem_tif_stpl_e/0500/

l=[
	'/home/thomas/Downloads/05001268_dem_spe/05001268_dem_spe.tif',
	'/home/thomas/Downloads/05001272_dem_spe/05001272_dem_spe.tif',
	'/home/thomas/Downloads/04961268_dem_spe/04961268_dem_spe.tif',
	'/home/thomas/Downloads/04961272_dem_spe/04961272_dem_spe.tif'
	]


# apt-get install python-gdal
import gdal
from gdalconst import * 


import WebGui
import Points


for fn in l:

	print fn
	dataset = gdal.Open(fn, GA_ReadOnly) 

	cols=dataset.RasterXSize
	rows=dataset.RasterYSize

	geotransform = dataset.GetGeoTransform()
	originX = geotransform[0]
	originY = geotransform[3]
	pixelWidth = geotransform[1]
	pixelHeight = geotransform[5]

	band = dataset.GetRasterBand(1)
	data = band.ReadAsArray(0, 0, cols, rows)

	print geotransform
	pts=[FreeCAD.Vector(originX+ pixelWidth*c,originY + pixelHeight*r,3*data[r,c]) for c in range(cols) for r in range(rows)]
	import Points

	Points.show(Points.Points(pts))

#-----------------------------------------------------

	step=100
	pts=np.array([FreeCAD.Vector(originX+ pixelWidth*c,originY + pixelHeight*r,3*data[r,c]) for c in range(0,cols,step)+[cols-1] for r in range(0,rows,step)+[rows-1]])
	pts=pts.reshape(cols/step+1,rows/step+1,3)

	bs=bs=Part.BSplineSurface()
	bs.interpolate(pts)
	fa=App.ActiveDocument.addObject('Part::Spline',fn)
	fa.Shape=bs.toShape()

User avatar
kkremitzki
Veteran
Posts: 2509
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Civil engineering feature implementation

Post by kkremitzki »

microelly2 wrote: It works fine, still the question where is 500 000/1272 000 in lon lat coordinates :?:
I want to check the data against google maps.
Try this calculator: https://beta.ngs.noaa.gov/gtkweb/ and click on:
- conversion to lat-long
- Datum: NAD83
- Projection: SPC (state plane coordinate system)
- Northing: 1272000
- Easting: 500000
- Unit: US survey feet
- SPC Zone: IN E-1301

which gives lat-long of 38.739099428, -85.063956181, which looks to be right around Vevay, Indiana.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Civil engineering feature implementation

Post by microelly2 »

Thank you, that's the trick, I have to learn to think in feet not in meter. :idea:
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Civil engineering feature implementation

Post by Kunda1 »

Joel_graff wrote: the first key task appears to be building horizontal and vertical geometry (alignments) that we can then use to extrude highway typical sections (most likely designed in the sketcher workbench). These alignments are defined with specific elements that must be accommodated for engineering design purposes.
+1
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
ginetto
Posts: 2
Joined: Thu May 11, 2017 4:03 pm

Re: Civil engineering feature implementation

Post by ginetto »

make sense to study some kind of integration with QGIS libs or PyQGIS itnerface for geodetic calculations?
starting for example creating a bridge o container for qgis vector data model or using the next GSOC python api interface planned to integrate qgis into Jupyter?
There could be are a lot of good synergies among FreeCad and QGIS project.

Any opinion?
Post Reply