Geocoder for Sketchup ruby API

hello everyone,

I’m trying to create a model of a house that exists in real life, and add an inputbox where the user can write the actual address of that house and then show location of that building in Google Maps.

i tried to install geocoder: Gem.install(“geocoder”)

but it doesn’t find it:

Code: Select allGem.install("geocoder")
Error: #<Gem::SpecificGemNotFoundException: Could not find a valid gem 'geocoder' (>= 0) locally or in a repository>
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/dependency_installer.rb:301:in `find_spec_by_name_and_version'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/dependency_installer.rb:110:in `available_set_for'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/dependency_installer.rb:322:in `install'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems.rb:526:in `install'
<main>:in `<main>'
SketchUp:1:in `eval'

does this gem works only for Ruby on Rails and Sinatra … ? is there another gem like geocoder that is used for the Ruby Sketchup API ?

thank you a lot.



It worked for me…


it worked thnx :slightly_smiling:

does this gem provide the possibility to generate a google map in a popup window containing the location based on a the address and street … given ?

‘Get Location’ already does that…

what are you trying to do that’s different?

or if you want to open in the users browser not SU…


you need to escape an address, but it works from Ruby Console or a plugin…


1 Like

thank you so much for your answer :slightly_smiling:
responds exactly to what i want

did you try any address’s?
you don’t even need the country or html escape, it just needs spaces replaced with a plus…

gsub('/ */, '+')


I do a similar thing with Google Translate…


1 Like

(Moved to Ruby API category.)

Also see this thread:
Is there anyway to open the Geo-location->Add location dialog by ruby?

1 Like

yeah i tried some addresses but instead of /place/ i used /search/ so it adds the “+” by itself and generates the /place/ with “+”
UI.openURL(" Toongarra Rd, Wulkuraka QLD 4305")

the code:



opens a popup an i need to write the address.
how can i open that popup with location of the house, that i take from an address ?

It would be really helpful if you explained exactly what your trying to do…

and why using ‘Get Location’ isn’t acceptable…

you can duplicate it’s functionality, but I can’t see why you need to…

you trigger it from a plugin…

# may differ on PC


thnx for your answer
i was trying to clique on menu and get a popup with the location of the house on a map based on the address given by the user.
i solved it using this code:

dlg ="Show location", true,
   "ShowSketchupDotCom", 739, 641, 150, 70, true);
 dlg.set_url ""

it shows a popup containing the location of the house based on the address

try this then…

dlg ="Show location", true, "ShowSketchupDotCom", 739, 641, 150, 70, true)
result = UI.inputbox(["Address"])
if result[0] != "" 
  reply = "" + result[0].gsub(/\s/, '+')

awsome thnx :slightly_smiling: