Posts tagged shapefile

January 26, 2016 Webinar Video now available online.

The video of the January 26th Webinar on merging tabular data with shape files is now available on our website. You can find it here. You can also download the powerpoint from the video here.

June 24th Webinar video on using Shapefiles now available.

The June 24th Webinar on using Shapefiles with Depiction is now available here.

You can download the powerpoint .pdf used in the webinar here.

You can download the American Fact Finder quick user guide here.

I learned something from this webinar. In the past when editing the exported csv from a shapefile, I always used a spreadsheet program but there is a problem with this method in many cases because complex shapes will create more lat/long sets than can be contained in a single cell. This messes up the file and those shapes won’t be reimported.  However, a webinar attendee suggested using a text editor to edit it.  Not sure why I hadn’t thought of it but that solves the problem.  And since you are only changing one field in the first row from “some property name” to “EID” it is pretty simple to do.

Why export data to a CSV file.

In our recent Depiction 101 Q&A webinar  ( of our customers asked the question about why one would want to export data to a CSV file if they had already imported it.  It was a good question and I came up with at least 5 reasons one might want to do that:

  1. Backup your data in a pre-geocoded format.
  2. If you moved elements to their geographically correct location, to save them in case you have to reload the elements at some point.
  3. To more easily make mass changes to the elements.
  4. To backup a subset of a large shape file.
  5. To change a shape file property to EID in order to merge data with it.

I wanted to elaborate a bit more on those reasons.

1. Backup your data in a pre-geocoded format.

When you import a CSV file with addresses.  Depiction goes out to the USC geo-coder and gets the latitude and longitude for each address and places the appropriate icon at that location.  Once you have done this, if you export those elements to a CSV file then they will include the lat/long of each element.  This way if you ever have to reload those elements or want to share them with somebody else, then the file won’t have to be geo-coded the next time. If you have a large CSV file this can save some time. It helps us too because every time you geo-code an address it costs us a few cents.

2. If you moved elements to their geographically correct location, to save them in case you have to reload the elements at some point.

This second item is similar to the first but with a little twist.  When the geo-coder geo-codes an address it will usually get it to the right block but not necessarily on the right lot in the block.  The reason for this is that if you an address of lets say 2025 main st, the geo-coder thinks that the address range for that block is 2000 to 2099. It calculates that 25 is one fourth of 99 and so it places the icon 1/4 of the way down that block.  Where in reality the real address range may be 2000 to 2032 and so the icon really should be at 9/10’s of the way down the block.  So if it is important to you to have the icons in the exact location you will have to go in and move each one.  Now if for some reason you have to reload that original  file then you are going to have to move all of those icons again.  Unless you had first exported it to a CSV file, in which case the program would have saved the new lat/long for each element.  So if you have to move a lot of icons to their geographically correct locations then backing them up to a CSV file is a really good idea.

3. To more easily make mass changes to the elements.

If you are using Depiction as a data base manager and are storing a lot of data along with each element, sometimes it is easier to make changes to the data in a spreadsheet program. So if you export them to a CSV file you can edit them in the spreadsheet program and then reload them.

4. To backup a subset of a large shape file.

A fairly new feature to Depiction in the 1.3 series is the ability to export shape files to a csv file.  So to give a specific example of when you might use this.  I was working with a community that was attempting to do a community wide map your neighborhood exercise.  One person had the entire community and a shape file was loaded that had all of the parcel boundaries for the community.  Using the shape drawing tool, we drew the neighborhood boundaries for all of the neighborhoods.  Then using the select tool we selected all of parcel shapes that were in a particular neighborhood. Then using the export to CSV function we exported the selected shapes to a CSV file.  Then we could start a new Depiction story and import that CSV file and we would have a depiction for just that neighborhood.  That file could then be given to the neighborhood coordinator who could use DepictionPrep to load the file and then make the appropriate changes and maps for their neighborhood.

5. To change a shape file property to EID in order to merge data with it.

This is really a neat feature.  Before we could export shapes to a CSV file this particular task was fairly complicated.

So lets say you have a shape file of zip codes and you also have some tabular data based on zip codes. In this tabular data  file you have the zip code and lets say median income, population, etc.  You want to be able to colorize your zip codes based on this numeric data. But how do you get the tabular data into the zip code shape elements. Here is a step by step process:

  1. Import your shape file
  2. Delete unwanted shapes (if necessary)
  3. Export your shapes to a CSV file
  4. Open the CSV file
  5. Change the property name of your key field i.e. zip code to EID and save the file
  6. In your depiction delete the shapes
  7. Re-import your CSV file of shapes
  8. Open your spreadsheet of data that you wish to merge.
  9. In our example we are saying the key field is Zip Code so in this file change the name of the zip code field to EID.
  10. Delete any other properties that aren’t of interest and then save that file
  11. In your Depiction chose Add by File and chose your csv file
  12. Select import by EID and then select Import – the data in this file will now be merged with the data in the shape file based on zip code
  13. Now if you open a shape element you should see the data fields you just imported and you can now colorize the shapes based on those fields.

Here are view other tips when dealing with CSV files.

TIP #1 – When you export elements it is best to export just one kind of element to a CSV file.  If you export multiple element types at once then you will get all of the properties for all of the elements in your resulting file, which is OK. But when you go to re-import that file all of the elements will have all of the properties of all of the elements which is probably not what you wanted.

TIP #2 - When you export to CSV it includes all of the default properties, any properties you have added and a bunch of depiction descriptive fields.  If you want can delete all of the descriptive fields to make the file easier to work with. We are looking to add a feature in a later release that would allow you to not have these fields show up on the export.

TIP #3 - If you are exporting a shape file and the shape is a fairly complex polygon it is possible that the number of points in that polygon will exceed the total amount of characters allowed in a single cell. In this particular situation we don’t have a solution to this and that shape may not be able to be re-imported properly.

I hope you find this information useful and feel free to send me any questions you have on any of it.

NOAA Weather Map Service

A customer asked if I knew of any sources for current hurricane info, so I did a search for “hurricane prediction WMS” and found this:

On the site, NOAA provides a set of Web Mapping Services (WMS) for

And more! Each services includes map layers for:

  • World Countries
  • World Rivers
  • World Lakes
  • Major Roads
  • Airport footprints

And more!

Being a WMS, all of the sources come into Depiction as images, so they will fill up your entire depiction area. Most of these will work better with large areas. You can put the links provided above (one at a time) into the Web serivces tab of the Add Content menu in Depiction, selecting the WMS option (see image). When you click Show content, you can then select the layer you want to view. You can do this multiple times with the same source or separate sources in the same depiction.

The Add Content Menu Web Service option

Let us know if you have any questions!

Happy Depicting!

UPDATE: There are also shapefiles of Hurricane Earl available from NOAA. Current predictions are here–the one you’ll want is the last ZIP file in the list. And the ‘cumulative wind history’ of Earl is here. It looks like NOAA will be keeping these up to date as time goes on. George will be using these shapefiles in the Depiction 101 webinar tomorrow morning.

Import ALOHA Plume Now

Without knowing that Bharath is working on integrating ALOHA Plume models into Depiction, one of our users contacted the ALOHA developers and asked them how to export a model as a shapefile. This would allow him (and other users) to import that file into Depiction. The ALOHA team was glad to help, and gave these instructions:

To make your shapefile:
1. Run the scenario and display the threat zone in ALOHA.
2. Open MARPLOT and click on the lat/long where the chemical was released.
3. From the ALOHA Sharing menu in MARPLOT, choose Set Source Point. The ALOHA threat zone is now displayed in MARPLOT with the source point of the release at the lat/long location that you clicked on.
4. In MARPLOT, select the ALOHA threat zone.
5. In MARPLOT File menu, choose Export Overlay Objects.
6. On the Export dialog, choose the Shapefile format. Note that if you have selected both polygon objects (the threat zones) and point objects (the ALOHA source point and/or the ALOHA threat point) you will need to perform separate exports for each type of object.

This assumes that the user is already familiar with ALOHA and MARPLOT, and considering the number of requests we have gotten for this information, many Depiction users are.

The user was also kind enough to send a depiction he then created using this method. I have altered it a bit (changed colors to match the descriptions of red, orange and yellow zones and the icons to our plume icon) for posting a clip here.

ALOHA Plume imported as shapefiles in Depiction

Screen capture of ALOHA/MARPLOT files in Depiction

I hope this will make Depiction all the more useful for our Emergency Management users.

Happy Depicting!