Developing Importer for .SHP (or SHX) to SketchUp

Do you think it’s possible to generate these models from some database that provides an outline of the which includes multiple heights within the footprint? Or does a database like that even exist?

The OSM database allows for building definitions that specify different heights of the roof (and type of roof) for the parts of larger buildings. However, it is limited at best. As near as I can determine, most of the detail data is manually massaged by private firms that make the custom database available for a fee. Several cities have posted individual building datasets in a wide variety of formats. Shapefiles and OSM are but two of them. If you haven’t looked into ArcGIS, you might find some interesting things there.

If the specific city doesn’t matter, you can find all kinds of detailed datasets, here and there, for random municipalities around the world. Great fun :slight_smile:

Thank you, I’ll look into that. I know I might be going a bit off topic here so forgive me but I just got wind of Infraworks 360 Model Builder. Have you heard of it? If so, I’d be interested to hear your thoughts!

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