Have a request from a client who would like to import orthophotos (.tiff format) and have them come in at the correct georeferenced position. Is there a free Rhino or GH plug-in that can do this? All I know how to do is get them as Pictures, but then repositioning/scaling them is manual…
That’s what I don’t know. In my case, the image name contains the coordinates for the lower left corner; and as I know the source from which it came, the tiles are all 1 square km. So in this particular case, with a script I can parse the file name and correctly place the image.
But for a more general case and also for reliability’s sake, it would be good to have a tool/plug-in that can get this info from the file itself (if it exists).
I haven’t used the Heron grasshopper add-on myself but the documentation indicates it can work with raster files. Its unclear if it can grab the location info from a Geotiff or similar.
Heron can import geotiff with the Import Raster component. Make sure the EarthAnchorPoint is set first (can be done with SetEAP component). And if you want a different coordinate system than WGS84 (EPSG:4326), use the SetSRS component.
Thanks for the info, I have no experience with Heron.
I got the file path for the file and connected it to the import raster component, I got a whole series of error messages - every time I click close a new one came up.
However, it isn’t at the correct geolocation as far as I can tell, the lower left corner should be at 2749,1259 (in km) or 2749000,1256000 in meters - that LLC coordinate is in the filename - but in fact the LLC ends up at 1350786.16,5875843.61 OTOH, the extents are correct at 1000 meters a side. Baking it only gets me the rectangle - is there something else I need to connect to get the image as a Picture in Rhino?
Also, I don’t really know what data I’m supposed use to connect to the EarthAnchorPoint… Maybe that’s the problem.
Hi @Helvetosaur ,
To get what I believe you’re expecting you will need to set Rhino’s EAP to the origin of LV95 (EPSG:2056). One way to do this is to use CoordinateTransform to get LV95’s origin in LAT/LON, then SetEAP with the results.
To bake to Rhino, I typically use Human components (Create/Modify Materials, CreateAttributes, SurfaceMap, and Bake).
But it seems a bit unreliable - when I hit “Update” the Grasshopper window will sometimes disappear and I have to call it up again, and it didn’t always update correctly (Rhino 8, GH 1).
Rhino also appears to be struggling with the orthophoto - it’s 10k x 10k pixels, so 100Mpix, and is around 60Mb. It takes a good 15 seconds to load or update and the laptop fans start to wind up. I tried importing the image separately with the import image component and that knocked Rhino into an endless unresponsive loop, and I had to kill it. Looks like the image import component in GH does not support .tif format.
It would be interesting to see if one could bake the image at the correct placement using the native V8 GH components instead of Human, but I didn’t see how to get the image file into GH that way.
Dunno, it imports fine in about 5 seconds via a script using Picture. But I suppose the texture is downsampled. The script parses the file title which by default in this case contains the lower left corner coordinates. But I wanted to see if it could read the coordinates directly from the file, as people might change the filename.
I just made that tool with a little help from ChatGPT so it is brand new and only testet on my machine.
You might need to restart Rhino 8. Sometimes importing new stuff with the automatet PIP # r: thing makes it stutter. A restart usually fixes that.
(ScriptEditor is the correct way to run it by the way)
Edit:
PS! I thought this was a 3D tiff, since it was just a 2D aerial it was quick to rewrite it so the tiff reader just pull out the bounds of the dataset and use this data to pictureframe the image.
Hi @Helvetosaur
It looks like this imagery is also served up as a Web Map Service (WMS), which, with a little effort, can be queried with the GdalWarp component. The benefits here are an arbitrary boundary and resolution without the need to download individual files. This may help with the file sizes. 20240108_SwissOrthophotos.gh (23.9 KB)
I downloaded a tile in my area. The coordinates in the title are for the lower left corner and the coordinates in the EXIF are for the top left corner.
Thanks for all the answers! I adapted Jørgen’s script using rasterio for my purposes and it seems the fastest and easiest way to go - it’s also more “portable” than a Grasshopper def.
For users of Rhino versions earlier than V8, I have a version that just parses the orthophoto’s filename to get the coordinates, it will also work fine for my clients who are here in CH if they don’t change the filename.