comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » 2D Array with a different value for every country
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: 2D Array with a different value for every country [message #94234 is a reply to message #94233] Thu, 02 March 2017 03:38 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Thursday, March 2, 2017 at 12:05:37 PM UTC+1, Helder wrote:
> On Thursday, March 2, 2017 at 11:01:43 AM UTC+1, c.beta...@fz-juelich.de wrote:
>> Dear Helder,
>>
>> OK. Still, there remain two problems: I can choose the color for water and land areas. I did not find any option or keyword to access a certain country. The second problem is, this is not an array that I could modify or fold with anything.
>>
>> Thank you,
>> Clara
>
> Hi,
> has I said, countries or imagery of the earth surface and stuff is not my stuff.
> But I have some good news: here you can find info about how to get coordinates of territories out of shapefile:
> http://www.idlcoyote.com/code_tips/extractpoly.php
> By the way, when you draw the maps of Europe, IDL gets the shapefile (where the borders are defined) from this file:
> IDL path\resource\maps\shape\cntry08.shp
>
> Now the bad news. The pro cgExtractShape is not for free:
> http://www.idlcoyote.com/idldoc/forsale/index.html
>
> You should ask David for a price, might be not that bad... But I sincerely have no idea.
>
> I bought some time ago activecontour.pro and I'm very happy with it.
>
> Cheers,
> Helder

Hi,
if you really *dare* to do the dirty work yourself, here is something to get you started.
Look at the shapefile format here: https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf

Now you can start unveiling what's inside. Here is the header. The rest is left as an exercise for the reader :-)

fn = 'fix_your_path\resource\maps\shape\cntry08.shp'
get_lun, fileUnit
openr, fileUnit, fn
fh = bytarr(100)
readu, fileUnit, fh
free_lun, fileUnit
print, 'File code = ', strtrim(swap_endian(fix(fh[0:3],0,type=13)),2)
print, 'File length = ', strtrim(swap_endian(fix(fh[24:27],0,type=13)),2)
print, 'Version = ', strtrim(fix(fh[28:31],0,type=13),2)
print, 'Shape type = ', strtrim(fix(fh[32:35],0,type=13),2)
print, 'File code = ', strtrim(swap_endian(fix(fh[0:3],0,type=13)),2)
print, 'File length = ', strtrim(swap_endian(fix(fh[24:27],0,type=13)),2)
print, 'Version = ', strtrim(fix(fh[28:31],0,type=13),2)
print, 'Shape type = ', strtrim(fix(fh[32:35],0,type=13),2)
print, 'bounding box xMin = ', strtrim(fix(fh[36:43],0,type=5),2)
print, 'bounding box yMin = ', strtrim(fix(fh[44:51],0,type=5),2)
print, 'bounding box xMax = ', strtrim(fix(fh[52:59],0,type=5),2)
print, 'bounding box yMax = ', strtrim(fix(fh[60:67],0,type=5),2)
print, 'bounding box zMin = ', strtrim(fix(fh[68:75],0,type=5),2)
print, 'bounding box zMax = ', strtrim(fix(fh[76:83],0,type=5),2)
print, 'bounding box mMin = ', strtrim(fix(fh[84:91],0,type=5),2)
print, 'bounding box mMax = ', strtrim(fix(fh[92:99],0,type=5),2)

This is what I got:
File code = 9994
File length = 1906850
Version = 1000
Shape type = 5
bounding box xMin = -180.00000
bounding box yMin = -90.000000
bounding box xMax = 180.00000
bounding box yMax = 83.623600
bounding box zMin = 0.00000000
bounding box zMax = 0.00000000
bounding box mMin = 0.00000000
bounding box mMax = 0.00000000

cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NetCDF version in IDL 8.6?
Next Topic: Use rtv_doit to generat a vector file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 22:58:07 PDT 2025

Total time taken to generate the page: 0.80335 seconds