Developing Importer for .SHP (or SHX) to SketchUp

I tend to think of geometry in terms of dimensionless units. Inasmuch as SketchUp uses inches internally, that’s my unit of choice. Once imported into SketchUp, it can be scaled as needed. This is admittedly a lame excuse for my lazy programming :wink:

Not that I’ve discovered … it’s similar to the STL format in that regard (see attached PDF).

You’re right, of course. My lazy hack for this is to provide a scale factor option. I messed around a bit with adding a geolocation option if the coordinates were in GPS units, but not much else has changed since I first wrote this.

I’m not terribly good at user interfaces … 99% of my production code runs at a much lower level and doesn’t interact with the user at all.

Here’s the Shapefile document I’ve used as a reference … it’s from 1998 so I’m not sure how current it might be. shapefile.pdf (123.8 KB)

The importance depend on context. For architectural projects scale is key. So formats that carry the unit type is essential. We had so many issues in my old job when people modeled plans in the wrong unit (in Autocad). Since DWG have a unit type included both Autocad and SketchUp would automatically scale imported file to appear in 1:1 scale. Which failed completely when the source file was tagged with the wrong label. And we had several cases where manual correction wasn’t precise enough - but very hard to detect.

1 Like

SHP files are absolutely unit less so you must know the source of the data. It could be lat lon or 1 of hundreds of other projections such as UTM. Furthermore the projection could be NAD83, GRS1980 etc.

There is another issue that you could run into. Certain projections are 1 way conversions. When you convert the data back to lat lon you loose accuracy.

There are other ESRI formats that do include the units.

Shape files contain both little endian and big endian values and can have you pulling your hair out.


1 Like

Thanks for creating this plugin. I’m trying to use it to import a number of shapefiles but I am getting little to no geometry imported. In the Ruby console I’m just getting an error for each item for importing. Usually nothing is imported or a few out of several hundred are imported. Any ideas on what I need to change?

Try increasing the scale to some ridiculous number like 100000 and see if it does anything different. Make sure you use the “Zoom Extents” to step back and view the results.

If you can provide an example of the errors you are getting in the console, that would be helpful as well.

Thanks, that definitely helped. Most of the items are being imported now. The only thing I have to figure out now is how to get the height properly scaled when I want a height parameter.

Here is the Ruby console I’m getting when I run the importer:

Processing: 313 records
An error occurred in 19
An error occurred in 38
An error occurred in 105
An error occurred in 115
An error occurred in 156
An error occurred in 166
An error occurred in 206
An error occurred in 257
An error occurred in 261
An error occurred in 277
An error occurred in 299
An error occurred in 304
Skipped: 12
Created: 301

Hi Jim,

I would like to download this extension, but when I try to open the file it says that there is no app associated with the file. Am I doing something wrong?

See the User Guide section …


A post was split to a new topic: New Modelur 2020 Tech Preview w/ GIS Importer

Jim, Is there a description of the dialog box options and what they do on your import shapefile extension?

Just a little confused on what the inputs do and how to manipulate to my advantage.

Shapefiles are comprised of three files: a *.shp file that contains the shape data; a *.shx index file linking the shapes; and a *.dbf file that contains additional data.

The values that are used are completely arbitrary in the sense that they may be GPS coordinates, meters from a reference point, or even furlongs, if that’s the choice of whomever made the shapefiles.

When using the plugin, select one of these files and you’ll be presented with something similar to the screenshot below:


  • The first line is a computed name for the import using the date-time stamp.
  • The second tells how many polyitems (shapes) are in the files.
  • The X/Y max/min data provides the bounding box of the data selected. Anything outside what you provide will be ignored on the input.
  • Numbers are assumed to be in inches; the scale value can be used to scale the values on input (or the model can be scaled after input)
  • The height is a default value that will be used if none are selected from the database.
  • If the database is used, it is denoted in this field.
  • If it is desired to display the bounding box on import, select this value as “YES.”
  • If you know that the shapefile data is in GPS coordinates, select the geolocate option to try and locate the model on import.

If using the database values, you will get a subsequent popup:


If this example, there are no height values to be useful. However, if there were, selecting the field for the height of the building, as well as the height of the base (if available), will use the various values from the database. The names of each building created will be tagged with the name field from the database (if one exists).

If no height values are available, you can select Display 2D instead.

I hope this helps … let me know what I need to clarify for you and I will try to do so.

Jim, great extension will definitely use it often!

2 suggestions, feel no obligations to add unless you want to.

  1. make the output a component with the groups nested in it. Maybe the component name is tied to the Name: in the dialog box. This would allow easier manipulation as a set. Granted, you can do it manually right after, but automatic would be nice.

  2. Make the “Number of PolyItems:” a specifiable range rather than the first XXX items. That way i could add the items in say 10000 item blocks (1-10000, 10001-20000, etc.) I was struggling to manually calculate where the area I was interested in resided in the shape file (this was not set to GPS or Lat/Long). It would have been easier to import by item number blocks and selectively deleting extraneous data.

1 Like

Just wanted to say thank you! This just saved me at least an hours worth of work tracing topo contours.

1 Like

I tried to use the spirix plugin to import a shp with z value and WGS84 coordinates. The setup window contains these values.
Once the shp is loaded I get this result. why?

It’s hard to tell without looking at your dataset. Can you zip the files and upload them here?

Thank you @jimhami42 !!
The file has an “UN_VOL_AV” column which represents the height of the building. (62.4 KB)


I don’t believe that the coordinate data is geolocatable. This is what I get when I don’t select that option:

You will have to geolocate it manually.

I had already verified that without geolocation the generation of polygons was obtained correctly but it is a shame not to use geolocation, which is fundamental for my work. I will look for a solution …
Thanks for the attention

The geolocation function uses GPS coordinates. The values in your dataset are not GPS. Manually set your model’s geolocation to


and try again. You will need to adjust the model size to fit. I’m sorry if this doesn’t do what you need it to.

This is what I have:

1 Like