Developing Importer for .SHP (or SHX) to SketchUp

Hi Jim – I’ve been searching for your email with no success! I’m integrating your Spirix Import Shapefile tool into my dissertation methodology, and was hoping to get citation information from you.

Hi Jimhami42,

Could you please post another link for the jimhami42_shapefile_importer.rbz file? It’s not downloadable right now.

Thanks in advance

Thodsapon

It’s been changed to a different name … also the behavior is slightly different.

https://sites.google.com/site/spirixcode/code/spirix_shapefile_importer.rbz

Let me know if you need assistance.

To Jimhami42,

I can import that file already. Thank you for this very helpful add-on. I was trying to convert file from SHP > COLLADA > SKP, but it couldn’t work! I’m so glad to be here this great SKP community.

Thank you,
Thodsapon

hi jimhami,
I tried the plugin with sketchup pro 2017 but nothing happens when I import shp or dbf files.
Is there anything I need to change or so?
Thanks a lot!

Hi @thorwaldhoffmann -

Can you provide a little more detail about the files you’re using? If you launch the Ruby console (Window >> Ruby Console) before running it, does it show any errors? It’s hard to tell what the problem is without a little more information.

I have been playing around with your last version of the plugin and a data set I downloaded from a NYC web site. Given the values displayed for the max and min, they appear to be longitude and latitude values. Is this the normal case?

From what I’ve seen, they can be most anything. It’s up to the database creator how they want to reference things.

With geoloc via add location, how can you import an ArcGIS SHP file that drops in the right place and not 0,0 origin? Shapefile is in WGS 1984 Geographic Coordinate System.
TIA

I am using the Spirix shapefile importer with SketchUp 2017 to import buildings and town park areas etc and it imports ok, but it loads the shapefile far too small. I’m having to measure the size of the objects and then re-import the shapefile and set the scale up to around 39.0 to get objects to line up with the town map.
Am I doing something wrong?

Did you guess that 39 is roughly 100/2.54 ?

Check if the importer has an options button where you can set the units of the .shp file that you want to import. It is probably in meters (1 = 1m), but the importer interpretes it in SketchUp’s internal units (1 = 1inch ~ 1/39m).

Thanks Aerilius. That is what is happening. My SketchUp model is set for metres.
I don’t see a setting in Spirix to set it to metres so I’ll just have to remember to use the scale of 39.37.

@Aerilius is correct. The importer assumes that the numbers are in inches … some datasets use feet, some meters, some use GPS coordinates. As noted, the appropriate scale factor appears to be 39.37 in your case.

Thanks Jimhami42

That’s probably because SketchUp’s internal units are inches. If the importer reads the file’s coordinates raw and feed them directly to SketchUp that’s what you’ll get. Does .SHP files have information about that units it represent? If it does then the importer should use that and apply appropriate conversion.
Short of that, like with STL, the importer could offer an Options dialog to let the user specify what the source unit is.

3 Likes

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.

Ouch!

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?