rth
Forum Replies Created
-
AuthorPosts
-
rthParticipantThanks for the quick answer and sorry for my late reply.
The thing is running in python. Here is the code I use (I did not write that myself, I simply have not had enough time to fully understand the structure of the data file):
`for npoly in range(shp.info()[0]):
shpsegs = []
shpinfo = []
shp_object = shp.read_object(npoly)
verts = shp_object.vertices()
rings = len(verts)
for ring in range(rings):
if ring == 0:
shapedict = dbf.read_record(npoly)
name = shapedict[“name_long”]
continent = shapedict[“continent”]
lons, lats = zip(*verts[ring])
if max(lons) > 721. or min(lons) < -721. or max(lats) > 91. or min(lats) <-91:
raise ValueError,msg
x, y = m(lons, lats)
shpsegs.append(zip(x,y))
# add information about ring number to dictionary.
shapedict = ring+1
shapedict = npoly+1
shpinfo.append(shapedict)
print name, continent
lines = LineCollection(shpsegs,antialiaseds=(1,))`
It gives me the desired reults so I was happy
Concerning your comments:
What does
mapcolor_9
do for me?
As you see I use the continent attribute for all countries which should not be couloured in a specific way.
And where do I find this
ocean
theme you were talking about? That would be most interesting.
rthParticipantI use name_long to find those countries I want to colour in a specific way, continent I use to colour all countries in Europe (which have not been coloured otherwise), Africa and Asia white, then all others are coloured blue (if you can tell me how to colour just the ocean in blue that would also be nice ).
I am solving this problem, that after all countries have been dealt with, I explicitly go to the Armenia and Albania data and plot them again.
(I would really like to attach a little picture, but have no idea how …)
-
AuthorPosts