Get latLong of origin?
-
Greetings, users!
I'm trying to find the point where a photo was taken in relation to a sketchup scene. The scene has been geolocated and has buildings constructed in their proper locations. I have the EXIF data of the photo: lat long, altitude, etc. Is there a way to plug this information into a ruby script and find the point?
My approach was to get the lat long of the scene's origin and finding the point by calculating distance and direction between the two locations.
Thank you ahead of time for any insight into my predicament!
-
@tompendergrass said:
Greetings, users!
I'm trying to find the point where a photo was taken in relation to a sketchup scene. The scene has been geolocated and has buildings constructed in their proper locations. I have the EXIF data of the photo: lat long, altitude, etc. Is there a way to plug this information into a ruby script and find the point?
My approach was to get the lat long of the scene's origin and finding the point by calculating distance and direction between the two locations.
Thank you ahead of time for any insight into my predicament!
This snippet example from the API documentation creates a construction point at the specified lat, lon:
# Draw a point in Boulder, Colorado (40.0170N, 105.2830W) lnglat_array = [-105.28300, 40.01700] model = Sketchup.active_model point = model.latlong_to_point lnglat_array model.entities.add_cpoint(point)
presumably you could set the z (blue) component of the point to your altitude.
Steve
-
IF there is no bugs re: this in your SU version.
Verify he page shado_info is ON:
page.use_shadow_info= true
Then get the lon & lat:
lon = page.shadow_info["Longitude"] lat = page.shadow_info["Latitude"]
You can create an API
Geom::LatLong
object:
llo = Geom::LatLong::new( [lat,lon ] )
There is also a Geom::UTM class in the API.
-
Also some SketchUp functionality (Google Earth, etc.) creates
AttributeDictionary
objects that have Lat and Long attributes.I think I published an example code snippet here.
Check the Code Snippets Index (It's a sticky post at the top of this forum.)Edit: It is [ Code ] GE "GeoLocation" AttributeDictionary v1.1.0
-
Yes, model.latlong_to_point should work. Though, for the altitude, I'm not sure if SketchUp takes that into account when it geo-locates models. I'd have to dig around to see if you can get the altitude of the geolocated model - so you can get the height right.
-
The "onOceanFloor" attribute of the "GeoLocation" dictionary is supposed to set the base (zero line,) for the altitude (IF exporting for Google Earth.)
The Ocean Modeling extension by "The SketchUp Team" adds a menu item to toggle add or delete the attribute. (If you are not modeling ocean floor shipwrecks, then you do not need the extension.)
-
Thank you for your help! Turns out the camera that the photos were taken off of had some weird GPS offset, which is why my photos were imported yet placed kilometers away. I solved my problem by using a 'reference point'. I have the user import one photo and place that photo where they believe it was taken. I use that photo's lat and long to modify the rest of the photos that were imported. Success
Advertisement