SULocationRef and SUModelGetLocation


Hi Experts,
I am trying read SketchUp file’s geo locations via SketchUp APIs and I got several questions about SULocationRef, SUModelGetLocation and SULocationGetLatLong,

  1. SUModelGetLocation will always return SU_ERROR_NONE (0) even the model wasn’t located. and the return latitude and longitude always consistent to a one of your office?
    Can the toolkit return SU_ERROR_NULL_POINTER_OUTPUT for model has no geolocation?

  2. SULocationRef object should I release it explicitly after using? If so what API should I use for releasing?


Got a sample snippet?

@Paul - can you take this one?


Hi tt_su,
please use these codes with the model I uploaded.

SULocationRef location;
    SUResult result = SUModelGetLocation(m_modelRef, &location);
    if(SU_ERROR_NONE == result)
        result = SULocationGetLatLong(location, &latitude, &longitude);
        return (result == SU_ERROR_NONE) ? kIsValueSpecified_Yes : kIsValueSpecified_No;

novi2.skp (718.3 KB)


Hmm… it looks like the C API doesn’t support to query whether to use the geo location data in the model or not.

What you can do as a workaround meanwhile is manually inspecting the UseGeoReferencing attribute in the GeoReference dictionary on the model object to see if geo location should be used:


Thanks for checking.
Do you know how to get the UsesGeoReferencing via C API?

And when the issue should be fixed?

BTW I click the component attribute item in the Window menu, it prompt me to select a component to show the attributes, however I don’t know how to correctly select the component, single/double click on a the small cube in my uploaded file don’t show any attributes…

Thank you,


BTW Do you know if the C API can get the altitude for the model?


Read the attribute on the model from the “GeoReference” AttributeDictionary.

I’m unable to provide a fixed timeline for this, sorry. But we have the issue filed.

That window display attributes related to Dynamic Components only. Attributes in SketchUp are much more generic than that and have to UI out of the box.

Here’s the tool I use to inspect attributes visually: (2.8 KB)

@jody - can we get RBZ files as allowed filetypes in the forum?


RBZ is already in there, did you try it and have it fail?


Thank you tt_su,
I am using such codes to get the property value:

        SUAttributeDictionaryRef attributeDict = SU_INVALID;
    SUResult result = SUModelGetAttributeDictionary(model, "GeoReference", &attributeDict);
    if(SU_ERROR_NONE == result)
        SUTypedValueRef typedValue;
        result = SUAttributeDictionaryGetValue(attributeDict, "UsesGeoReferencing", &typedValue);
        if(SU_ERROR_NONE == result)
            bool bUseGeoReferencing = false;
            SUTypedValueGetBool(typedValue, &bUseGeoReferencing);

The code can get the GeoReference dictionary, but failed to get the typevalude with “UsesGeoReferencing” key.


Looks like you are missing a call to SUTypedValueCreate. Remember to release it once you are done.


It works! Thank you tt_su!.

BTW is it possible for the C API return altitude beside longitude & latitude?



Hm… not exactly sure what info we have on altitude… @Paul, @bugra?


Hi tt_su,
we have found another model even can’t be handled by the workaround since it don’t have the “GeoReference” dictionary.

May I know your tracking number for this issue? and I assume you will post the tracking number in what’s new/ readme when this issue got fixed?


Then you treat it as the model isn’t geo located.

We’ve not been posting issue numbers with our changelogs.

I see . Excellent.