Chapter Contents

Previous

Next
The GMAP Procedure

Creating Map Data Sets

In addition to using map data sets that are supplied with SAS/GRAPH software, you may want to create your own map data sets. Map data sets are not limited to geographic data; you use them to define other spaces such as floor plans or street diagrams. This section explains more about the structure of map data sets.

A unit area is defined by observations in the map data set that have the same identification (ID) variable value. A unit area may be composed of a single polygon or a collection of polygons. A polygon is defined by all of the observations that have the same SEGMENT variable value.


Creating a unit area that is a single polygon.

This DATA step creates a SAS data set that contains coordinates for a unit area with a single polygon, a square:

data square;
   input id x y;
   datalines;
1 0 0
1 0 40
1 40 40
1 40 0
;

This data set does not have a SEGMENT variable.


Creating a unit area that contains multiple polygons.

Use different values of the SEGMENT variable to create separate polygons within a single unit area. For example, this DATA step assigns two values to the SEGMENT variable. The resulting data set produces a single unit area that contains two polygons, as shown in Single Unit Area with Two Segments (Polygons):

data map;
   input id $ 1-8 segment x y;
   datalines;
square   1 0 0
square   1 0 4
square   1 4 4
square   1 4 0
square   2 5 5
square   2 5 7
square   2 7 7
square   2 7 5
;

Single Unit Area with Two Segments (Polygons)

[IMAGE]


Creating a unit area that contains enclosed polygons as holes.

Use separate boundaries to create an enclosed polygon (that is, a polygon that falls within the primary polygon for a single segment). The separate boundaries are separated from the primary polygon boundary by missing values for X and Y. For example, the data set that is created by this DATA step produces the map shown in Single Unit Area with Hole:

data map;
   input id $ 1-8 segment x y;
   datalines;
square   1 0 0
square   1 0 4
square   1 4 4
square   1 4 0
square   1 . .
square   1 1 1
square   1 2 2
square   1 3 1
;

Single Unit Area with Hole

[IMAGE]


Creating a unit area that contains enclosed polygons as cities.

Ordinarily, if one unit area is surrounded by another, the pattern of the external unit area is drawn over the pattern for the internal one, instead of around it. Avoid this problem by adding an observation to the map data for the external unit area with missing values for X and Y, followed by the coordinates of the internal unit area, but using the ID values for the external unit area. For example, this DATA step creates a data set that produces the map shown in Unit Area within a Unit Area:

data map;
   input id $ 1-8 segment x y;
   datalines;
square   1 0 0
square   1 0 4
square   1 4 4
square   1 4 0
square   1 . .
square   1 1 1
square   1 2 2
square   1 3 1
triangle 1 1 1
triangle 1 2 2
triangle 1 3 1
;

Unit Area within a Unit Area

[IMAGE]

Note:   A single map segment (a section of a unit area with a single value of the SEGMENT variable) cannot contain multiple polygons without at least one observation with missing values for X and Y. All segments within the map data sets that are supplied by SAS/GRAPH contain a single polygon that can have one or more separate boundaries, each separated by an observation with missing values for X and Y.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.