Function latlong_to_point gives unexpected results

geolocation
georeference

#1

I’ve got a georeferenced model and I want to import some data into it. The data comes from OpenStreetMap and contains lat and lon coordinates, so I used Sketchup’s internal function model.latlong_to_point. But the resulting data were created 5 228 000 km far from origin, although they are in the same area as the model. Furthermore they were stretched in the north-south direction and flipped as shown in this image:

(Blue edges = imported data, other colors = original model)

.

I found this very strange, so I tried to test how the function works. This piece of code is supposed to give [0,0,0], because I use the model’s geolocation and feed it into the latlong_to_point function.

model = Sketchup.active_model
si = model.shadow_info
model.latlong_to_point [
  si["Latitude"],
  si["Longitude"]
]

.

But instead of

Point3d(0,0,0)

I get this:

Point3d(1.54736e+08, -1.35691e+08, 0)

.

Either I don’t get how to use the function or it’s broken :cry:


Unexpected utm_to_point behaviour
#2

Ahaa!

The function is called latlong_to_point, but you have to pass long first, then lat!

Problem solved, never mind!


#3

Yeah, someone wasn’t thinking clearly when they implemented that method!