Developing Importer for .SHP (or SHX) to SketchUp

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?

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 …

2 Likes

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