Basemap Data File File Format

I would like to know the file formats of the following file data files in the Matplotlib Basemap toolkit

  • country * .dat
  • countriesmeta * .dat
  • gshhs * .dat
  • rivers * .dat
  • rivermeta * .dat
  • states * .dat
  • statesmeta * .dat

I would also like to know if there are tools to manage these files.

+4
source share
1 answer

I only experimented a bit:

"gshhs_c.dat" is a binary file containing a long list of lon, lat points of all coasts as the number of single-precision floating-point numbers 32b:

lon1, lat1, lon2, lat2, ..., lonn, latn.

the file "gshhsmeta_c.dat" contains information about the relationships of these points:

1, area, numpoints, limit_south, limit_north, startbyte, numbytes, id-(E/W crosses dateline east or west) 

In my case, the first entry (eurasia):

 1 50654050.7558 1004 1.26950 77.71625 0 8032 0-E 

We can read and build it with:

 import numpy as np import matplotlib.pyplot as plt binfile = open('gshhs_c.dat','rb') data = np.fromfile(binfile,'<f4') data = data.reshape(len(data)/2,2) plt.plot(data[:1004,0],data[:1004,1]) plt.show() 

Other files should have more or less the same format, as they are read by the same function.

EDIT: Some versions of the base version do not have line intersections. The file format is essentially the same

+2
source

Source: https://habr.com/ru/post/1445187/


All Articles