EnjShape

EnjShape is a pure Ruby plugin for Sketchup that allows you to import ESRI Shapefiles.

Download: version 0.2

enjshape_button

click here to browse source

(if you have trouble with the zip file, try the download button on this page)

Usage:
1) Make sure enjshape.rb and the enjshape directory are in your Sketchup plugins directory.
For me this is:
Windows –

C:Program FilesGoogleGoogle SketchUp 7Plugins

Mac OS X –

/Library/Application Support/Google SketchUp 7/SketchUp/plugins

2) Go to Preferences -> Extensions and activate the plugin ENJ’s Shapefile Importer
3) Go to Plugins -> EnjShape -> Import Shapefile
4) Open a Shapefile!

Functionality:
Currently supported Shapefile types:
Point
Arc (PolyLine)
Polygon

If your shapefile is in WGS84 (LatLong) it is flattened (to a 2d plane) and converted to inches (but still georeferenced)

If your shapefile is already projected to a 2d coordsys you can just specificy whether the units are in feet/meters

Shapefile -> Google Earth
1. Open Google Earth
2. Open SketchUp
3. Import (latlong) shapefile into SketchUp using EnjShape
4. Use the “place model” tool to put the model in Google Earth
5. Click on the model in the Google Earth navigation to zoom to the model
6. In SketchUp click the “get current view”
7. Now you can use the “toggle terrain” tool to accurately edit the imported shape for use on Google Earth

Testing:
I don’t have use cases for a lot of the shapetypes. They are implemented according to the shapefile spec, but may have bugs. If you run into one please contact me and give me sample data so I can debug.

Shoutouts:
Props to SwaJime for swa.rb which taught me a lot and gives the latlong converting functionality through his LLAtude class.

Thanks to the one who pointed out I could write this myself instead of waiting.

-Ian Johnson
enjalot@gmail.com

24 thoughts on “EnjShape

  1. Andreas Wulf Post author

    Dear Ian,

    I have a question regarding your EnjShape SketchUp plugin. I try to import a shapefile into SketchUp 7.1 Pro at my MAC. But after pressing the button “Render” nothing happens. I found this question already at some internet forums, but without solution.
    Do you meanwhile know why the import ends without result and error message?

    Your help is highly appreciated.

    With best regards from Germany (only 3rd place, NL is 2nd: congratulations!),
    Andreas

  2. enj Post author

    Andreas,
    Thanks for your comment, I think I may have fixed the problem. I found 2 bugs, so hopefully the updated code will work for you. Let me know!

  3. Mark Springate

    temporary comment:
    this looks promising but the zip file does not seem to be valid with any zip tools – is it possible that since your recent update the zip has problems – or maybe its just at my end? – thanks in advance – Mark

  4. enj Post author

    Hi Mark,
    I just rezipped the code manually (instead of using the github.com zip file)
    The link should hopefully work now
    Thanks
    Ian

  5. Forrest

    I got through the installation OK. I opened Google SketchUP to import a shapefile. Hear is where hte problem started. First I noticed that the type file drop down was empty. As you know shapefiles are made of multiple files. Consequently I couldn’t actually open a “shapefile.” That’s as far as I got. Can you help me? Google SketchUp is now hung.

  6. Pingback: Side Projects | enj

  7. enj Post author

    Paul,
    Perhaps your browser cached the zip file?
    I can open it fine on Mac and Linux (sorry I don’t have a windows machine to test with right now)

    At some point there was a problem with the zip file but I redid it and it should be fine now

  8. Forrest

    I couldn’t open the zip file. WinZip reported that, “Cannot open file: it does not appear to be a valid archive.”

  9. Dan

    I’m also having difficulty. I was able to open the zip file using 7zip, but the only file in there was enjshape-022

    It doesn’t seem to be working for me.

  10. Sorbus

    Hi Ian,

    I’ve installed your plugin and the menu option is there, however, nothing appears to happen once I’ve opened the .shp file. Any thoughts as to where I’m going wrong?

    Cheers,

    Sorbus

    (Sketchup 7.1 for Mac OS 10.6.6)

  11. enj Post author

    Hi Sorbus,
    You can turn on the Ruby console before running the plugin and send me the output, or if your .shp file is not sensitive data you can send it to me and I’ll try to debug. Keep in mind that my plugin only works on points, polylines and polygons right now
    Ian

  12. Sorbus

    Hi Ian,

    I think I found the problem for myself, as I’d used a 2d coordsys that the plugin didn’t like (OS GB 1936:epsg 27700). I changed the CRS in QGIS to WGS84 and all was well. Ruby console originally was:

    Error: #
    /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/enjshape/load.rb:88:in `parseshp'
    /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/enjshape/load.rb:175:in `eval'
    /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/enjshape/load.rb:88:in `parseshp'
    /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/enjshape/load.rb:175:in `loadShapeFile'
    /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/enjshape/load.rb:361

    I have one suggestion to make if I may… When the bounds of the .shp are read, could the lat, long centre point be returned at some stage, so the user can copy and paste this easily into google earth? That way, easing the process to use the ‘get current view’ command in SketchUp 7 to place the terrain and imagery into the SketchUp file (I know the rotation for the north point would still have to be tweaked). Or, even better, call upon GE and set the view automatically using the GE API: http://earth.google.com/comapi/interfaceIApplicationGE.html

    That would speed up the workflow between open source GIS and GE/SU tremendously!

    Cheers,

    Sorbus

  13. hardik

    Hi Enj,

    I tried to install your plugin for importing shapefile into Google Sketchup, but however the plugin is not seen in sketchup. Please tell me how to install the ruby script.

  14. Peter

    Hi Ian,

    Extracting the files to the indicated folder doesn’t seem to put the files where Sketchup expects them?? Program Files\Google\Google SketchUp 7\Plugins\enjshape

    I don’t find the Plug in to activate in Window->Preferences->Extensions. I’ve been successful with other plugins.

    I get a load error when I restart Sketchup 7 that says “Error Loading File enjshape.rb
    No such file to load — enjshape/binary”

    I’ve tried moving the enjshape.rb file to various locations but that has not done the trick.

    Yer thoughts?

    Peter

  15. enj Post author

    Hi Peter,

    You should have an enjshape.rb and an enjshape folder, these two should be in the Plugins directory next to each other. I don’t have a windows machine to test on at the moment unfortunately.

  16. Klas Karlsson

    THANK YOU!!! You Rock!!!

    I’ve been looking for something like this for a very long time. Now i can use my GIS data in SketchUp and do a quick visualization with accurate measurements and distances, and with help from on site photos create a very realistic 3D environment.

  17. Pingback: SketchUp « Geosupportsystem

  18. Gwen

    I tried to install it in SketchUp 8 Pro. I can get all the way to the import shapefile window and I select one and nothing happens.

    Any ideas?

  19. Eric

    I’m changing the projection to WGS84 (using ESRI world map). And I only get a few islands that successfully posts into sketchup. Does anybody have any tips?

    ES

  20. Stephen Hubbard

    Hi. I’m using Version 8/Win XP and get the following error when it opens.

    Error Loading File enjshape.rb
    no such file to load — enjshape/binary

    Any ideas?

  21. Andrew

    Dear enj, thanks for making this available to everyone. I have installed it in the same way that I have installed all other tools, but it crashes out. I am using SketchUp 8 with WinXP and get the following error. Any suggestions?

    Error: #
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:88:in `parseshp’
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:175:in `eval’
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:88:in `parseshp’
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:175:in `loadShapeFile’
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:361
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:88:in `call’
    C:/Program Files/Google/Google SketchUp 8/Plugins/enjshape/load.rb:88

  22. John

    Thank you for the plug in. The shapefile I was trying to use didn’t work for some reason (turns out the file contained 5 polygons). I would be glad to provide the file if you wanted to see why it wasn’t working.

    But on a slightly different note I was hoping that you could help me in my efforts on a project I am working on for grad school. As part of my research one of my tasks is to create a piece of software that is to display a map of the surrounding area, show the current location (from a GPS), and to implement a shapefile (as a boundary outline). I am not able to really get enough information to get on the right track on how to do this, and would appreciate any assistance!

    The project involves a large-scale robot that will be operated by tele-communication in rough terrain. So this mapping and gps software will need to be entirely offline, but the location in use will be known. It is very preferred to find a cost effective means to doing this process (maybe even a simple API that could do the simple task, dll libraries, or active x.

    My initial guess is to use a geo-referenced image (that I would get the lat and long of and know the boundaries of that image). Then from a GPS I then would treat the image as an XY plot somehow and that would provide the current position. Obviously even this step can be a challenge depending on what kind of image, map, kml file, etc that I can find and use.

    So I would appreciate any advice, suggestions, or comments.

    Sincerely,
    John

  23. Ian

    @John
    Your project sounds interesting. It seems like you need a GIS backend for querying geographic information (given current XY location, what is near me?) that can live on the robot. My personal preference would be to use PostGIS as my geographic database to store the maps or other information and then python to query it. It depends on what kind of processing power and storage space you have on the robot, but I would definitely start by looking at open source solutions. qgis is another open source GIS program which may also give you some starting points.

Comments are closed.