Wednesday, October 12, 2005

Import Shape Files

Sometimes you want to import a shape file into your GTViewer session. Here's handy tool I wrote for a client and would like to share with the GTViewer development community at large. (We have lots of tools in GTData to help you bring entire shape file datasets into the format used by GTViewer, but this one lets you bring in just one, while you are in a session.)

Usage is pretty simple. You pull down the Query menu, select the app, and then browse to the shape file, and press the button.

Two items are hard coded, and you are welcome to change them for your app. One is the category number. My client did not have a category 10, so I used 10. This is only for temporary use, so even if you have a category 10, it ought not to matter. The other item is the coordinate factors that make the shape file come into GTViewer at the right position relative to the rest of the data. You may need to adjust these.

As usual, you will need to add the application to the .gtm file in the [External Applications] section.

Sample code can be downloaded from http://www.gti-us.com/Blog/ImportShape.zip

Let me know how it works for you, and feel free to send me your improvements!

Charlie charles.marlin@gti-us.com

No comments: