Can Sketchup 2018 import kml, kmz or gpx files


#1

I’d like to import tracks from a gps app that provides kml, kmz or gpx files. Can SketchUp 2018 do that?
If so, how?


#2

SketchUp has no built in or standard ability to import kml or gpx. It can import collada (dae) if embedded in a kmz, but not the other types (kmz is a zipped archive that can embed several kinds of files). There were some efforts in the past to create an extension for kml but I think they are no longer active.

I think you will need to use a separate utility to convert the kml into a format that SketchUp can read such as dxf. You would have to geolocate the model for the imported coordinates to make sense.


#3

Thanks for the reply. It is surprising that this capability does not exist. It seems like such a useful and obvious thing to do.

I think that kml files can be imported into AutoCAD and could then be exported as dxf and then imported into SketchUp.

I have AutoCAD 2015, but I almost never use it and don’t know how to import the kml file.

To geolocate, I guess you could use “Add Location”. Would that be sufficient?

Do you know of any utility that includes collada in a kmz generated from a kml?


#4

As a bit of background, years ago I did quite a bit of work in physical geodesy so I had to learn about earth coordinate systems such as WGS 84 and the various transformations between them. I’m also a computer geek, so I like to understand file formats. But geodesy hasn’t been part of my job description for a long time and I haven’t kept track of what utilities or preferred workflows may be available today.

I don’t use AutoCAD myself so I can’t speak from experience, but if it can import kml this could be a way to convert them. One thing to be wary of is that AutoCAD is quite tolerant of having the model coordinate origin far from the model contents (as would happen if it converts using either the geodetic origin or center of the earth), whereas SketchUp wants the model data to be located close to its origin. We see frequent issues here on the forum due to this difference. One must exercise care when importing a dxf or dwg into SketchUp.

A quick web search found a few other utilities that say they can do the conversion, though again I haven’t tried any of them.

Yes, that’s what I meant. Unless the model is geolocated there will be no earth-related interpretation of the model coordinates. A kmz that embeds a collada file will specify where the origin of the 3D cartesian collada coordinates lies.

Sorry, no.


#5

As mentioned, you may want to try going from a kml to a DXF fist. You can then import the DXF linework into SketchUp.

Here is one service to try out - https://mygeodata.cloud/converter/kml-to-dxf

Let us know how it goes

CD


#6

If anyone else wants to do this, I more or less solved it. I say “more or less” because there is a scale factor that needs to be applied and I don’t know where it comes from.
My steps:

  1. I got used an Android tracking app on my phone called “Geotracker” that keeps track of where I walk. Some apps allow you to capture waypoints. With Geotracker, I exported the track to a kml file (it can also export to kmz or gpx).
    I opened the kml file with Google Earth to see what it looked like. I was accurately placed. Here is a screenshot from Google Earth of the track that I made.
  2. I converted the kml file to dxf using the site https://mygeodata.cloud/converter/kml-to-dxf and downloaded the dxf
  3. When I imported the dxf to SketchUp, it was almost invisible being approximately 0 inches. In addition, there were only 4 segments to the polyline. The track is actually about .7 miles long and has many segments as you can see.
  4. I then opened the dxf file with AutoCAD 2015. Here is the track in AutoCAD. It has all the points. I shows the length of the polyline to be .0115 inches. Why it does that, I don’t know, but it is similar to what SketchUp did, except that SketchUp lost most of the points in the line.
  5. I measured the distance between two points in Google Earth and between the same two points in AutoCAD. Then scaled the AutoCAD drawing to bring it to the same size. The scale factor (that brought it close) was 4,252,500. I saved the AutoCAD drawing as a dwg.
  6. Then I imported the dwg into SketchUp. It looked about right, but was not in the right place, although it was close. That very likely had something to do with the scaling in AutoCAD which keeps one point fixed. So, one would have to choose the right point.

I have attached the kml file and the dxf converted from https://mygeodata.cloud/converter/kml-to-dxf (unscaled)

If anyone knows how the scaling works, or any other part of this, it would be great to know.

Huck


#7

Hey Huck - I’ve seen a lot of your posts around trying to get a boundary defined in google earth into Sketch Up. I am struggling to find a way to do this too - I’ve just tried to use the above approach of converting a .kmz to the .dfx file, however, when trying to import a simple outline around a field (such as you would find in a planning application) I get the notification that some of the geometry is extremely far from the model origin. It seems nuts that this is so difficult to achieve!

Are you able to help me out at all? You seem to be extremely knowledgeable and it would bring some much needed consistency to our site boundaries if we could directly import the kmzs provided by our clients, as opposed to having to essentially redraw them by eye.


#8

The scaling is almost certainly from decimal degrees to inches, as GPS works in degrees on the WGS 84 ellipsoid and SketchUp’s internal units are always inches (what you set in Model Info->Inches determines how they are displayed and input in the GUI, but they are always converted to inches in the model’s geometry database).

Looking up nominal values, 1 deg latitude ~ 110575m = 4,353,346"
Not quite what you got, but in the ballpark, so I think that’s what is going on.

You said you attached the kml file, but it isn’t in your post - just the link to the cloud-based converter. If you upload it, I’d be interested to take a look and see just what it contains. It seems likely it uses only a small portion of the full KML suite of elements, in which case it might be possible to create a simple, single-purpose importer.


#9

Here is the KML file (attached)WalkJan_19,_2019_3_36_04_PM.kml (22.3 KB)


#10

Rosefly, I’m not sure I can help you much beyond the instructions in my post. One thing you may want to do is geolocate your model first. (File>Geo-location>Add-Location). Then you have to deal with the scaling problem I mentioned.


#11

Yes, the file contains data in lat, lon, altitude format where the lat and lon are decimal degrees. But these units are implicit in the kml elements used, not explicitly declared by the file. So, the conversion to dxf took them as unitless numbers, and then the import into SketchUp took them as inches.

This should be solvable, but give me a while to work on it…


#12

I’m excited to hear what you find out.

Although it is a little circuitous, this is at least a possible way to import GPS data. Very useful.


#13

Progress report: I have the basic track import code working. Today I plan to make it more robust, as the test code depends on some unchecked assumptions about the file and might break or import nonsense if they aren’t true. Then I’ll wrap it as a proper extension that if you want you can help test.

Note: I’m not attempting a complete kml importer at this point, just an ad-hoc one for this particular use.


#14

I have a beta version that appears to work. @huckrorick check your Private Messages.

If anyone else would like to test this, please PM me.

Be aware though, this does not attempt to be a general-purpose or comprehensive kml importer. It is focused on the track elements captured by the Android app referenced by the OP. @Aerilius wrote one in 2013 (see SketchUcation’s plugin store), but it hasn’t been touched since and I don’t know whether it still works given the subsequent updates to the Ruby version and API in SketchUp.


#15

Steve,

I am just sending a note to apologize for not testing your code. I’m excited to try it. I have been overwhelmed with a project that I haven’t been able to break free from.

I will test it soon. It’s something I have wanted for a long time.

Huck


#16

Hi Steve,
I just tried the RBZ. It works great. I only tried it 2 kml files. But now that I have something that works, I’m going to do a bunch more. One question. The elevations do not seem to correspond with Google Earth. It looks like the vertical displacements are correct, but the track sits about 278’ above the Google Terrain. Looking at the track from above, it fits perfectly (i.e. the horizontal locations are perfect).
Huck


#17

This is most likely due to me assuming the altitudes were in meters. Can you look at your gps and see what it says for altitude?


#18

Google Earth shows elevations in feet, but I think you can change that.
The App I am using is called Geo Tracker. It is an Android phone app and is free in the PlayStore. It shows elevation in feet, but again, that may be select able. And I don’t know how it would store it in a KML file. I assume that would not be select-able. I believe it is possible to communicate with the app maker. Email is support+app@geo-tracker.org. I could ask questions.


#19

Try this version - it assumes the altitudes are in feet. While doing this I noticed that the previous version had an error when it geolocated the model: it was setting the reference altitude in inches because I forgot to specify units!

SB_KML_Track_import_feet.rbz (3.8 KB)


#20

Interesting. The first version had one of the points I measured 269’ above the Google Earth terrain. With the new version it is 59’ above the Google Earth terrain (there are some inches I didn’t show in the measurement).