This is part two, of the so far two part series, on Heron tools for Grasshopper and their adaptation to generate topography and buildings from IMG/SHP files. The idea is to automate the process of creating those two objects so that we can spend more time improving our designs and less time tracing over Google Maps to get building shapes.
The process of obtaining shape files and making them usable with the Heron tools is a little less straight forward than what you saw previously with the topo tools. We can obtain shape files through the same means as IMG files, using USGS Map Viewer. Problem with this method is that you have to hope that different local municipalities made them available there. Most likely you will have to search the website of the municipality that you are interested in and look there for shape files.
One of the problems that I had when I was prepping this tutorial was that for some reason shape files downloaded from the NYC Open Data website were saved corrupted. I turned to Brian – Heron creator – and was told this: “It seems there is a conflict with the way the projection file was written for that shape file and the “standard” held by the GDAL libraries: http://gis.stackexchange.com/questions/61823/ogr-projection-transformation-error What we need to do is re-project the shape file to the correct projection, which is beyond the scope of what Heron can (or should?) do. In this case we need to set the projection to:
EPSG:3785 – Popular Visualisation CRS / Mercator
If you are familiar with QGIS, you can just open it there, set the Coordinate Reference System to the correct projection (see below) under the layer properties and re-save the shape file (with a new name would probably be best).”
Now for someone that has ever used QGIS I guess that’s a pretty simple task, but for me, well it took a little bit of time but I was able to get it to work and now I am sharing that with you all.
- Download QGIS. It’s free. Download it here: http://qgis.org/downloads/QGIS-OSGeo4W-2.8.1-1-Setup-x86_64.exe
- Start the QGIS Desktop version and go to Layer>AddLayer>Add Vector Layer
- Browse to your *shp file and when prompted for projection settings pick: EPSG:3785 – Popular Visualisation CRS / Mercator
- Hit OK and then on the left hand side under Layers right click the newly created layer and Save As:
- Save that new shape file under a different name and now you can load it up into Grasshopper.
Now, this is just one of the possible issues that you will face, considering that you can get that far, because getting the shape file is a challenge in itself. Anyways, if you manage to get the file and if needed re-project it, then you should be good to go.
The Grasshopper side:
The Grasshopper set up is a little bit more elaborate this time. The idea is to extract shapes of all buildings and their heights. Then filter out all shapes that have height of zer0 (0), and unify the two data structures. Then I am using Mantis Shrimp to export both shapes and heights to Dynamo.
The Dynamo side:
Now this was only tested, and not very extensively as I hope that someone will pick this up and make something good with this, with Revit 2014. Yes, I know this sucks, but it will not work on Revit 2015 and even though it will take exactly two lines of code to make it work, I am too lazy to do it tonight. :-P
Anyways here’s the magical code for it: