How to know longitude, latitude coordinates of the pointer on a geolocalized sketchup model

Having geolocalized my sketchup model I would like to know how to get the longitude, latitude, altitude coordinates of the pointer when I move it on the model.
Any way to get that ?

I don’t know of any built-in tool or extension for that (if anyone knows of one, please correct me). It seems it wouldn’t be terribly hard to write an extension for this.

Unless you live near map 0 of the map system you use its probably a bad idea to geolocalise your model, because SketchUp does not work well modeling far from model origin.

I and others have advocated for having a setting that uses a local 0, and just adds georeferencing as a model setting

One can, in layout, use coordinates, and add ones 6000 kilometres or whatever, in front of the value that the label tool provides, so as to give building coordinates.

Having a local 0 is what SketchUp does when you choose site map, but that does not provide the accuracy of setting local 0 referenced to a mapping system like UTM, so then a manual override will fix it.

What sort of precision do you need in your latitude and longitube indications? How large is the area of your model?

You can paste this code snippet in the Ruby Console:

class MouseWorldPosition
  def initialize
    @input_point = Sketchup::InputPoint.new
    @model = Sketchup.active_model
  end

  def onMouseMove(flags, x, y, view)
    # pick the point under the mouse cursor
    @input_point.pick(view, x, y)
    if @input_point.valid?
      point_under_mouse = @input_point.position
      lat_long = @model.point_to_latlong(point_under_mouse).to_a
      puts "#{lat_long[1]},#{lat_long[0]} Altitude=#{lat_long[2]}"
    else
      puts "No valid point under mouse."
    end
  end
end

Sketchup.active_model.select_tool(MouseWorldPosition.new)

The lat,long is printed in the order suitable for pasting into a google maps URL

To disable it, pick another tool or in the ruby console:

Sketchup.active_model.select_tool(nil)

Dan

1 Like

Just be aware that puts from within onMouseMove will generate a tremendous amount of output to the Ruby Console. That event fires very often!

There is an extension for that at Sketucation