Importing ESRI shapefiles

Importing ESRI shapefiles

Postby mozzie » Tue Jul 02, 2019 4:36 am

I've spent a bit of time investigating this, as i can get quite good terrain information (1 or 2m elevation data) from local sources. I've been using QGIS (3.6) to overlay KML files provided to me with road design and other info and have been quite impressed with the results.
I use Sketchup Pro 8 with Toposhaper (Fredo6) to produce terrain surfaces and SuperDrape (TIG) to overlay satellite or other client images and to allow some modelling - so I need a good way to get from QGIS to SU8.

I found a plugin by Jim Hamilton works best - spirix_shapefile_importer - there are a number of others but his is reliable and allows the elevation data to be imported from the DBF file that is a component of the shapefiles.

It has one limitation, however; it does not deal with model units except inches (the internal SU standard) and I need meters. The code is public (with acknowledgement), so I have hacked together a quick modification to provide a units dropdown with some basic options.

In case this is useful to someone, here is the hack /modifications.

1) Replace lines 172 & 173 with
Code: Select all
        prompts = ["Name: ","Number of PolyItems: ","X (min): ","Y (min): ","X (max): ","Y (max): ","Scale Units: ","Height: ","Database: ","Display BB: ","Geolocate: "]
        defaults = [@@name,@@imax,@@bbox[0],@@bbox[1],@@bbox[2],@@bbox[3],"m","0.0","No","No","No"]
        list = ["","","","","","","m|cm|mm|in|ft","","No|Yes","No|Yes","No|Yes"]

2) Replace line 181 with this case statement.
Code: Select all
#---------------------------- Replaces @@scale = input[6].to_f -------------
        @@scale = case         # this value needs to reflect the base shapefile units converted to inches
          when input[6]=="m"
          when input[6]=="cm"
          when input[6]=="mm"
          when input[6]=="in"
          when input[6]=="ft"


SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Ad Machine 


Return to Google Earth

Who is online

Users browsing this forum: No registered users and 0 guests

Visit our sponsors: