turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS/GRAPH and ODS Graphics
- /
- proc gmap remove border/ draw new border using map...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-27-2013 02:31 PM

Hi! Just need a little help using maps.counties.

Using maps.counties as a base data set I need to remove boundaries between two adjacent counties and redraw a new boundary.

For example, in California (state 6) I need to remove the boundary between Riverside County (county 65) and Orange County (county 59) and redraw a vertical line where x = 2.0475 (so now Orange County's new border extends into Riverside).

I was thinking I could use proc gremove to remove the boundary, but how would I add the new vertical boundary at x = 2.0475? I know sort order is important, so where would this new boundary need to be placed in my counties dataset?

Thanks for any help/ hints given!

Accepted Solutions

Solution

08-27-2013
03:27 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cjinsf

08-27-2013 03:27 PM

First, why are you moving the country boundary? Has the county line actually changed?

If so, you might consider using the new MAPSGFK map library (first released with 9.3m2).

Unless this is a very recent change, it should be reflected in this data.

As far as removing and adding the boundary in your current map, is isn't trivial.

Gremove can take a counties data set and remove the internal county lines and leave you with the state boundary only. It does this by having multiple variables to identify the area. One is the state and one is the county. So, to remove the line between these counties, you need a similar set of values that indicates these 2 counties are in the same larger group (like state was above).

Adding a line back is difficult. You must end up with 2 polygons and you have now created one out of the two areas. You really need to know the y and x values at each end of this new line, that is, where the new line intersects the outside polygon. And that line coordinates must be inserted into each polygons.

Looking at the example below, you have straight boundary lines. But your counties will not and there may not already be a point where you want to insert the new line. This starts after you removed the existing line and now have only one polygon.

y, x

1,3 1.5,3 2,3

-----------------------------------------------------

| A | After removing - Only have polygon "A"

| |

------------------------------------------------------

1,4 2,4

In the map data set, the data might look like this:

ID y x segment

A 1 3 1

A 2 3 1

A 2 4 1

A 1 4 1

What you need:

y,x

1,3 1.5,3 2,3

-----------------------------------------------------

| A | B | After adding new line and having 2 polygons.

| | |

------------------------------------------------------

1,4 2,4

You need to change it to, where A and B are the 2 different counties.

ID y x segment

A 1 3 1

A 1.5 3 1 <= New Line

A 1.5 4 1 <= New Line

A 1 4 1

B 1.5 3 1 <= New Line

B 2 3 1

B 2 4 1

B 1.5 4 1 <= New Line

You will probably have to add this manually using data step code.

Hope that helps.

All Replies

Solution

08-27-2013
03:27 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cjinsf

08-27-2013 03:27 PM

First, why are you moving the country boundary? Has the county line actually changed?

If so, you might consider using the new MAPSGFK map library (first released with 9.3m2).

Unless this is a very recent change, it should be reflected in this data.

As far as removing and adding the boundary in your current map, is isn't trivial.

Gremove can take a counties data set and remove the internal county lines and leave you with the state boundary only. It does this by having multiple variables to identify the area. One is the state and one is the county. So, to remove the line between these counties, you need a similar set of values that indicates these 2 counties are in the same larger group (like state was above).

Adding a line back is difficult. You must end up with 2 polygons and you have now created one out of the two areas. You really need to know the y and x values at each end of this new line, that is, where the new line intersects the outside polygon. And that line coordinates must be inserted into each polygons.

Looking at the example below, you have straight boundary lines. But your counties will not and there may not already be a point where you want to insert the new line. This starts after you removed the existing line and now have only one polygon.

y, x

1,3 1.5,3 2,3

-----------------------------------------------------

| A | After removing - Only have polygon "A"

| |

------------------------------------------------------

1,4 2,4

In the map data set, the data might look like this:

ID y x segment

A 1 3 1

A 2 3 1

A 2 4 1

A 1 4 1

What you need:

y,x

1,3 1.5,3 2,3

-----------------------------------------------------

| A | B | After adding new line and having 2 polygons.

| | |

------------------------------------------------------

1,4 2,4

You need to change it to, where A and B are the 2 different counties.

ID y x segment

A 1 3 1

A 1.5 3 1 <= New Line

A 1.5 4 1 <= New Line

A 1 4 1

B 1.5 3 1 <= New Line

B 2 3 1

B 2 4 1

B 1.5 4 1 <= New Line

You will probably have to add this manually using data step code.

Hope that helps.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to cjinsf

08-27-2013 04:22 PM

Thank you! Exactly what I needed. County boundaries haven't changed; just using this as a guide to annotate areas that *mostly* follow county lines to define specific areas of interest on a state/ county map.

Thanks again!