sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] KML Tools (2.0.0-beta) — updated 31.05.2013

    Scheduled Pinned Locked Moved Plugins
    137 Posts 49 Posters 124.4k Views 49 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • coda13C Offline
      coda13
      last edited by

      thank you very much!

      1 Reply Last reply Reply Quote 0
      • A Offline
        Aerilius
        last edited by

        **@thomthom said:

        You're using a webdialog for the import - you can use the XML parsing capabilities of the web-browser:
        http://www.w3schools.com/xml/xml_parser.asp
        **

        I'm working on a solution with a DOM xml parser.
        It's more than 5 times faster than REXML (and probably much more in newer browsers). 😍

        1 Reply Last reply Reply Quote 0
        • A Offline
          Aerilius
          last edited by

          A quick update for compatibility with SketchUp 2013. It was released so quickly.
          This is the last version before 2.0

          1 Reply Last reply Reply Quote 0
          • A Offline
            Aerilius
            last edited by

            I have uploaded a beta version of KML Tools 2.0!
            If you like, please help testing and give me feedback if files don't work with it.
            The new version has

            • significant speed improvements, up to 7× faster import
            • a reliable xml parser and better support for nested kml structures
            • better error handling
            1 Reply Last reply Reply Quote 0
            • K Offline
              kubark42
              last edited by

              Just tried the beta, but it made no file output, just an empty directory. 1.4 works fine for me with the same workflow, so I'm either doing something wrong or it's not working on my model.

              EDIT: Sorry, I should have included some info. This is OSX 10.8 running SU8. Model can be downloaded from https://www.dropbox.com/s/q5a1hzqvcwlc39u/Geo-fence.skp

              1 Reply Last reply Reply Quote 0
              • K Offline
                kubark42
                last edited by

                So this tool is really awesome, and almost exactly what I need. Thanks a million!

                Time for a tiny bug report: when setting the altitude mode to absolute altitude, instead of adjusting the Z values to the true altitudes, the script just sets the altitudeMode field to "absolute". The result is that a model that was drawn on the surface is buried in the ground in Google Earth.

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Aerilius
                  last edited by

                  Thanks for the feedback! I'll check your file and fix it.

                  1 Reply Last reply Reply Quote 0
                  • K Offline
                    kubark42
                    last edited by

                    Okay, figured out the second bug, and why I wasn't seeing it before:

                    
                        if facecolor
                          @out.puts "  <Style>"
                          @out.puts "    <LineStyle>"
                          @out.puts "      <color>#{linecolor}</color>"
                          @out.puts "      <colorMode>normal</colorMode>"
                          @out.puts "      <width>1</width>"
                          @out.puts "    </LineStyle>"
                          @out.puts "    <PolyStyle>"
                          @out.puts "      <color>#{facecolor}</color>"
                          @out.puts "      <colorMode>normal</colorMode>"
                          @out.puts "      <fill>1</fill>"
                          @out.puts "      <outline>1</outline>"
                          @out.puts "    </PolyStyle>"
                          @out.puts "  </Style>"
                          @out.puts "  <MultiGeometry>"
                        end
                    
                    

                    only places the <MultiGeometry> tag if there is a facecolor. So moving " @out.puts " <MultiGeometry>"
                    " to right after the "end" solves the problem.

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      kubark42
                      last edited by

                      Hi, Aerilius--

                      I found out why I was having altitude problems. I don't program in ruby, but it looks close enough to other languages iI do program that I was able to muddle through it and realize that Altitude is not an attribute in GeoReference, so get_attribute("GeoReference","Altitude") returns 0. By changing Altitude to ZValueCentered, I was able to get a negative value in inches that is seemingly correct for my elevation. I cannot find a definitive reference on this, and there is also ModelTranslationZ which has the identical value for me, so I'm unclear which is the appropriate way forward. However, both solve my problem. So in conclusion, I've replaced line 253 by @ground = -@model.get_attribute("GeoReference","ZValueCentered").to_f.to_m and that solved my problem.

                      Now I'm struggling with an odd error. For some reason when exporting a group to multigeometry the KML is missing the opening <MultiGeometry> tag, but it has the closing one. This causes an import error in KML until I manually add the XML tag.

                      EDIT: terrain_alt([0,0,0]).to_m doesn't seem to return any sensible values. I'm interested if you have an idea about this, too.

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        Kromaggs
                        last edited by

                        I'm using Bash under Window to dynamically generate a ruby script. This script allow me to import a specific KML file in sketchup and when the import is done I would like to export my model to KMZ file. This is an extract of my ruby script

                        
                        #----------------------------------------------------------
                        	# Impport du modèle KML.
                        	model = Sketchup.active_model	
                        	status = model.import inKML, false
                        	
                        	if status
                        		#----------------------------------------------------------
                        		# Suppression du modèle KML importé.
                        		#File.delete( inKML )
                        
                        		#----------------------------------------------------------
                        		# Export du modèle au format KMZ.
                        		modelFile=File.basename( inKML, ".kml" )
                        		exportPath = exportDir + modelFile + ".kmz"
                        		model.export exportPath
                        		model.entities.clear!
                        
                        		#Sketchup.undo
                        		#Sketchup.app_safe_shutdown
                        	end
                        
                        

                        But the import KML plugin seems to give back the control to my script while importing, so the exported KMZ is not complete because the KML is not completely imported.

                        Any idea about this problem ?

                        1 Reply Last reply Reply Quote 0
                        • O Offline
                          organicmotion
                          last edited by

                          "File seems not to exist.
                          Please check that the file path does not contain Unicode characters. This is a limitation of SketchUp and its Ruby version."
                          Am I doing something wrong? Took the KMZ file from gps opened in Google earth saved as KML then tried to import into SU with the KMLtools and I get the error above..
                          any ideas anyone? Thanks, I am a beginner with SU 😄

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            truga
                            last edited by

                            It appears that KML Tools are not yet compatible with 2014. I get the message:

                            Error Loading File kmlDate.rb
                            Error: #<SyntaxError: C:/Users/truga/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/kmlDate.rb:77: formal argument cannot be a global variable
                            ...previewTimeLine") {|$kmlDateDlg, param|
                            ...

                            etc.

                            1 Reply Last reply Reply Quote 0
                            • B Offline
                              borrel
                              last edited by

                              @organicmotion said:

                              "File seems not to exist.
                              Please check that the file path does not contain Unicode characters. This is a limitation of SketchUp and its Ruby version."

                              I am getting the same problem (Mac OSX 10.9.2) with v 2013 and 2014 - with Google SketchUp 8.0.15157 - the old version works fine. Sad, because SU is a great tool for visualization AND a converter to make X3D files from GPS-GPX tracks thus: GPS tracker > GPX > KML (gpsbabel or GPS Viz) > SKP > VRML (WRL) > X3D (via aopt). See the models here: http://abdallah.hiof.no/drone/index.html

                              1 Reply Last reply Reply Quote 0
                              • G Offline
                                Gorin21
                                last edited by

                                Hi,

                                great job with the plugin! I would like to know, if the functionality of adding timestamps can be included in next release? In 2.0 beta there is none, in the previous stable version, there is availability to add a timestamp.

                                Thanks for the reply,

                                Paul

                                1 Reply Last reply Reply Quote 0
                                • B Offline
                                  BIANI patrick
                                  last edited by

                                  Sir, would it be possible to have a detailed using your KML exporter of interesting tutorial.
                                  I would like to export animations 'Keyframe' to Google earth to animate a plane flight or a vehicle path, but do not have your talent developer, looking for a simple tool that can help me in this regard,
                                  thank you for your attention.
                                  Patrick
                                  patrickbiani13@gmail.com
                                  http://www.wix.com/patrickbiani13/scan-service

                                  1 Reply Last reply Reply Quote 0
                                  • B Offline
                                    BIANI patrick
                                    last edited by

                                    Sir, I have installed your update (SketchUp 8 Pro), but I can not find anywhere in the menu can add Timespan, thank you for your help

                                    1 Reply Last reply Reply Quote 0
                                    • A Offline
                                      Antimo98
                                      last edited by

                                      I use SketchUp 2014.
                                      The file (attached) contains an image and a single poligon realized and exported in KML by Google Earth
                                      When I run the kml tools for any files .kml everywhere it is in PC (c:, Desktop, other directory) always it says:

                                      1. "the model does not contain a Google Earth terrain. Do you want import one first , Yes No"
                                        in both cases
                                      2. "File seems non to exist. Please check the file path does not contain Unicode characters. This is a limitation of SketchUp and its Ruby version."

                                      Where is the problem?

                                      Thank you for all contributions.
                                      Regards
                                      Antimo


                                      Good in Google Earth but not in SU.

                                      1 Reply Last reply Reply Quote 0
                                      • B Offline
                                        balique_bap
                                        last edited by

                                        @antimo98 said:

                                        I use SketchUp 2014.
                                        The file (attached) contains an image and a single poligon realized and exported in KML by Google Earth
                                        When I run the kml tools for any files .kml everywhere it is in PC (c:, Desktop, other directory) always it says:

                                        1. "the model does not contain a Google Earth terrain. Do you want import one first , Yes No"
                                          in both cases
                                        2. "File seems non to exist. Please check the file path does not contain Unicode characters. This is a limitation of SketchUp and its Ruby version."

                                        Where is the problem?

                                        Thank you for all contributions.
                                        Regards
                                        Antimo

                                        I have the same issue.

                                        Has anybody found a solution ?

                                        Thank you very much,

                                        Baptiste

                                        1 Reply Last reply Reply Quote 0
                                        • B Offline
                                          balique_bap
                                          last edited by

                                          Post to be deleted.

                                          1 Reply Last reply Reply Quote 0
                                          • U Offline
                                            usablake
                                            last edited by

                                            Sweet plugin, any plans for an update to use with new versions?

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 1 / 7
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement