Subscribe Bookmark
arati_mejdal

Staff

Joined:

May 21, 2014

An add-in to combine map shapes

With JMP, you can easily show data geographically with maps. However, you can only show your data if the regions you want to show exactly match up with the regions JMP has in its installed maps, or any maps you might have. This makes showing data by larger divisions, like regions of a country, more difficult. I developed an add-in that is designed to alleviate this problem by allowing you to combine existing smaller shapes into new larger ones.

So let’s run through an example with some FBI crime data. Notice that the only data given is in terms of regions, which JMP does not normally recognize. So in order to map this data with JMP, we want to create map definitions that fit these names. To do this, let’s use the new Combine Map Shapes add-in – downloadable from the JMP File Exchange (download requires a free SAS profile).

The data looks like this:

So to prepare a map file for this data, let’s launch the Combine Shapes add-in; you should see a screen like the one below:

With this screen, you need to first pick the map name file. You can select where to search for this file with the radio buttons below. Remember that JMP maps are represented by two files; here you want to open the “-Name.jmp” file. For this example, let’s look in the built-in maps for a file called “US-State-Name.jmp” that holds the state names. Selecting this file and clicking Continue will bring you to a new window with the map in question shown.

With this map, you can drag your mouse over areas or use shift+click to select the areas that you want to represent with a single name. In the picture below, I have selected the area corresponding to the “West” region data table:

Press “Finish Region” to finalize this region and to go on to the others. When you have set all of your regions as you would like them, you still have two options at the bottom of the window: to keep internal borders and save the map files in an alternate location. By default, the shapes are combined with the internal borders kept and are saved in JMP’s user-installed map directory.

When you have selected and finalized every region from your data, press “Merge Region.” The add-in will take the selections and merge each of them into a single JMP map shape. After the merge, you can use these files to map data as you normally would. You can even just use Graph Builder if you chose to save the maps in their default save locations. (However, you may have to restart JMP to use these newly added maps in Graph Builder.)

The visualization from this particular example is below. With this, you can clearly demonstrate graphically that the South has the most property crimes, while the Northeast has the fewest.

Here is the same visualization, but done without keeping internal borders:

A little note about the inner workings of the add-in: Maps in JMP are stored in pairs of data tables, one mapping the different areas’ names to a specific ID number, and the other mapping that ID number to a list of X/Y coordinates for displaying geographically. What this add-in does is take your area selections and look for intersection points between the areas selected. When it has these intersection points, it follows along the edges to find a single border following the combined shape – excluding the line between the two shapes if you opted not to keep the internal borders.

NOTE: This post was written by a former intern on the JMP development team.

6 Comments
Community Member

Sarah wrote:

This ad-in looks perfect for my needs (using JMP version 12). It doesn't look like this ad-in is available any more, though. Do you have any other suggestions? Trying to aggregate my US counties into regions.

Staff

Xan Gregg wrote:

I've added the add-in to the new File Exchange and fixed the link. Hope it suits your needs.

Community Member

James wrote:

I am unable to combine counties using JMP's built-in county maps. I am able to combine states fine though.

After choosing the Name and XY files, I get this error:

Scoped data table access requires a data table column or variable in access or evaluation of 'dtName:Name' , dtName:Name/*###*/

Anyone else getting this? I notice that some others also want to combine counties, but no one else seems to be reporting this issue...

Staff

Xan Gregg wrote:

I know we've done counties before but I'm seeing the same error now. It looks as if the add-in is depending on the -Names table having a column called "Name". Until that gets fixed, you might try renaming "Full Name Short" to "Name" in a copy of the table.

Community Member

MG Crissey wrote:

I made a note of that very detail as I watched the JMP webcast this afternoon. struck me a it odd to be so necessary - ensuring we give JMP a table with column names with the "proper" titles. Once the archived link is available I encourage others to watch the demo of three good case studies showing this very issue in geographic mapping .

tag
Community Member

I was having the same issue as @WP_Comment trying to combine UK counties into regions - so I went into the XY and Name files and found that one of the files had a "Shape" column, and the other had "Shape ID".  When I named them both "Shape ID" and saved the files it started working - haven't had the error since