Sarath,
> Is there a subroutine or a document which can tell me how to read the
> Ezmap binary data files. I am trying to read the EzmapOutlines.PS or
> EzmapOutlines.US file.
It wasn't really intended that these files be accessible through the user
interface, so there's no advertised way to do it, but it isn't too bad.
The following program reads through "EzmapOutlines.PS":
PROGRAM SARATH
COMMON /MAPCM3/ ITPN,NOUT,NPTS,IGID,IDLS,IDRS,BLAG,SLAG,
+ BLOG,SLOG,PNTS(200),IDOS(4)
CALL OPNGKS
CALL MAPSTC ('OU','PS')
CALL MAPINT
CALL SET (.01,.99,.01,.99,-180.,180.,-90.,90.,1)
CALL MAPIO (1)
101 CALL MAPIO (2)
IF (NPTS.EQ.0) GO TO 103
CALL MAPIT (PNTS(1),PNTS(2),0)
DO 102 K=2,NPTS-1
CALL MAPIT (PNTS(2*K-1),PNTS(2*K),1)
102 CONTINUE
CALL MAPIT (PNTS(2*NPTS-1),PNTS(2*NPTS),2)
GO TO 101
103 CALL FRAME
CALL CLSGKS
STOP
END
MAPCM3 is an EZMAP common block used to communicate with the routine MAPIO,
which actually reads the dataset. First, we open GKS. We tell EZMAP that
we want to use the outline dataset 'PS', and initialize the package by calling
MAPINT. Then, the call to MAPIO with a "1" initializes the reading of the
selected outline dataset and each call to MAPIO with a "2" tells it to read
the next record. The contents of the record come back in MAPCM3: NPTS is the
number of polyline points read; IGID is a "group identifier" (best ignored),
IDLS is the area identifier of the area to the left of the polyline; IDRS
is the area identifier of the area to the right of the polyline; BLAG, SLAG,
BLOG, and SLOG are the biggest and smallest latitude and longitude occurring
in the polyline; and (PNTS(I),I=1,2*NPTS) are lat/lon pairs for the NPTS
points of the polyline. IDOS is not from the record read and you probably
don't need it; it's an array of area-identifier offsets; for a given EZMAP
dataset with index NOUT, the area identifiers in the dataset are biased by
the addition of IDOS(NOUT) in order to generate a unique value. The
following DATA statement defines it:
DATA IDOS / 0,222,439,1003 /
In this program, all I have done with the polylines is plot them. The
"globe" comes out as a square because I put in a SET call overriding the
one that MAPINT did; it maps longitudes from -180 to +180 onto the whole
horizontal axis of the "plotter frame" and latitudes from -90 to +90
onto the whole vertical axis of the "plotter frame".
If you want to get below the level of the routine MAPIO, you'll need to
pick up a copy of it and follow what it does. It talks to some lower-level
C routines that do things like return a character string representing the
NCAR Graphics database directory, open a file for reading, return integers
from the file, return floating-point numbers from the file, close the file,
and so on ... If necessary, I could extract the salient bits of the code
for you.
I hope this is helpful ...
Dave Kennison
This archive was generated by hypermail 2b29 : Mon May 14 2001 - 15:17:07 MDT