When modifying geo-location via the API Sketchup.active_model.shadow_info keys, the Model Info → Geo-location panel does not update, and still reports “This model is not geo-located” (1). If I click “Set Manual Location…” (2), the location data is shown, and then only after clicking OK, the message “This model is manually geo-located” (3) is displayed.
(1) Set geo-location data via API, “This model is not geo-located” is still displayed.
(2) Click “Set Manual Location…”, the data is there
(3) Only after manually clicking OK, the message “This model is manually geo-located” is displayed
So the question: Is there a way to effective press the “OK” button via the API?
Otherwise this is not great UX and I would consider it a bug.
Tested on SU2022 Mac, SU2023 Mac. Does it behave the same on Windows?
I looked at that attribute dictionary mentioned by @JeffR, and calling
model.set_attribute("GeoReference", "UsesGeoReferencing", true)
DOES seem to cause the message to switch to “This model is manually geo-located”!
Additionally, when the UI is reporting “This model is not manually geo-located” model.get_attribute("GeoReference", "UsesGeoReferencing") returns false
then clicking “Set manual location…”, and “OK” without modifying the data, model.get_attribute("GeoReference", "UsesGeoReferencing") now returns true
This was typing at the console, I haven’t tried it in the running extension yet.
That seems rather crazy that the SketchUp UI is displaying the geo-location status based on the value of an attribute like that (and not an internal setting in the file). As noted by others, this attribute dictionary is an undocumented API which is a hangover from the Google days, that may well be fully deprecated at some point, so i wouldn’t really be a robust solution to use that, but maybe it will suffice as a workaround for now.
Shadow Info location predates the Geolocation introduced during the Google era. Shadow info dictates how the sun should be positioned and light the scene.
Geolocation includes some additional information, that was stored in attributes as you’ve noted. However, we don’t have an API for this at this point. Please make sure to add your comment to any existing issues in the tracker or log a new one if one is missing for any features you wish to see.
So you are on Mac, and Jeff is on Windows. It looks like there is a platform difference.
It may be documented in the Google Earth API, which SketchUp no longer uses itself.
I’m not even sure that Google Earth will use geolocated SKP models anymore. Has anyone tried it with a recent SKP and a recent version of Google Earth ?
I geolocated a model this morning, exported to kmz and opened it with Google Earth (downloaded at that moment) and the model was placed in the right place.