Quantcast

How to draw a specific country by basemap?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to draw a specific country by basemap?

Eric Liang
Hi all,

I'm using the Basemap module in matplotlib, it's great to draw a world map but for a specific country. Empirically, one can draw its own country by specifying the lats and longs like this example:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country boundries, but all the countries are in the same colour. Does anyone know how to highlight a specific country? Thanks in advance.

Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a specific country by basemap?

Thomas Lecocq
Hi,

An easy way is to use the data from http://www.gadm.org/ and to plot it with m.readshapefile()

HTH,

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




Date: Wed, 26 Jan 2011 16:03:27 +0800
From: [hidden email]
To: [hidden email]
Subject: [Matplotlib-users] How to draw a specific country by basemap?

Hi all,

I'm using the Basemap module in matplotlib, it's great to draw a world map but for a specific country. Empirically, one can draw its own country by specifying the lats and longs like this example:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country boundries, but all the countries are in the same colour. Does anyone know how to highlight a specific country? Thanks in advance.

Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a specific country by basemap?

Eric Liang
On 01/27/2011 01:38 AM, Thomas Lecocq wrote:
Hi,

An easy way is to use the data from http://www.gadm.org/ and to plot it with m.readshapefile()
Thank you very much. The GDAM database is great.

BTW,  would you like to give some suggestions about how to color the map, i.e., highlight a specific region? 

Thanks,
Eric


HTH,

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




Date: Wed, 26 Jan 2011 16:03:27 +0800
From: [hidden email]
To: [hidden email]
Subject: [Matplotlib-users] How to draw a specific country by basemap?

Hi all,

I'm using the Basemap module in matplotlib, it's great to draw a world map but for a specific country. Empirically, one can draw its own country by specifying the lats and longs like this example:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country boundries, but all the countries are in the same colour. Does anyone know how to highlight a specific country? Thanks in advance.

Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a specific country by basemap?

Thomas Lecocq
Hi,

that would do:
 
data = m.readshapefile(r'borders\ita_adm1','itaborder',linewidth=0.5)
italy = data[4]
print dir(italy)
italy.set_facecolors('red')
italy.set_alpha(0.5)

 
I think at some point you"ll meet the limitations of the method, you might need to use another shapefile-reading module ...
 
Thom
 

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


 

Date: Thu, 27 Jan 2011 17:59:03 +0800
From: [hidden email]
To: [hidden email]
CC: [hidden email]; [hidden email]
Subject: Re: [Matplotlib-users] How to draw a specific country by basemap?

On 01/27/2011 01:38 AM, Thomas Lecocq wrote:
Hi,

An easy way is to use the data from http://www.gadm.org/ and to plot it with m.readshapefile()
Thank you very much. The GDAM database is great.

BTW,  would you like to give some suggestions about how to color the map, i.e., highlight a specific region? 

Thanks,
Eric


HTH,

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




Date: Wed, 26 Jan 2011 16:03:27 +0800
From: [hidden email]
To: [hidden email]
Subject: [Matplotlib-users] How to draw a specific country by basemap?

Hi all,

I'm using the Basemap module in matplotlib, it's great to draw a world map but for a specific country. Empirically, one can draw its own country by specifying the lats and longs like this example:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country boundries, but all the countries are in the same colour. Does anyone know how to highlight a specific country? Thanks in advance.

Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a specific country by basemap?

Thomas Lecocq
Hi,
 
Adding some extra work in the readshapefile method in your code allows you to play with the region names etc,...
 
I've just made a new tutorial script to show this :
 
http://www.geophysique.be/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/
 
 
Thom
 

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


 

Date: Thu, 27 Jan 2011 17:59:03 +0800
From: [hidden email]
To: [hidden email]
CC: [hidden email]; [hidden email]
Subject: Re: [Matplotlib-users] How to draw a specific country by basemap?

On 01/27/2011 01:38 AM, Thomas Lecocq wrote:
Hi,

An easy way is to use the data from http://www.gadm.org/ and to plot it with m.readshapefile()
Thank you very much. The GDAM database is great.

BTW,  would you like to give some suggestions about how to color the map, i.e., highlight a specific region? 

Thanks,
Eric


HTH,

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




Date: Wed, 26 Jan 2011 16:03:27 +0800
From: [hidden email]
To: [hidden email]
Subject: [Matplotlib-users] How to draw a specific country by basemap?

Hi all,

I'm using the Basemap module in matplotlib, it's great to draw a world map but for a specific country. Empirically, one can draw its own country by specifying the lats and longs like this example:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country boundries, but all the countries are in the same colour. Does anyone know how to highlight a specific country? Thanks in advance.

Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to draw a specific country by basemap?

Eric Liang
On 01/27/2011 09:24 PM, Thomas Lecocq wrote:
Hi,
 
Adding some extra work in the readshapefile method in your code allows you to play with the region names etc,...
 
I've just made a new tutorial script to show this :
 
http://www.geophysique.be/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/
 
Thanks for your great job, it's brilliant!

And sorry for the long time delay to reply your mail, as I've just been back from the Chinese new year's vacation.

Wishing you peace, joy and happiness throughout the coming year!
Eric

 
Thom
 

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************


 

Date: Thu, 27 Jan 2011 17:59:03 +0800
From: [hidden email]
To: [hidden email]
CC: [hidden email]; [hidden email]
Subject: Re: [Matplotlib-users] How to draw a specific country by basemap?

On 01/27/2011 01:38 AM, Thomas Lecocq wrote:
Hi,

An easy way is to use the data from http://www.gadm.org/ and to plot it with m.readshapefile()
Thank you very much. The GDAM database is great.

BTW,  would you like to give some suggestions about how to color the map, i.e., highlight a specific region? 

Thanks,
Eric


HTH,

Thom

**********************
Thomas Lecocq
Geologist
Ph.D.Student (Seismology)
Royal Observatory of Belgium
**********************




Date: Wed, 26 Jan 2011 16:03:27 +0800
From: [hidden email]
To: [hidden email]
Subject: [Matplotlib-users] How to draw a specific country by basemap?

Hi all,

I'm using the Basemap module in matplotlib, it's great to draw a world map but for a specific country. Empirically, one can draw its own country by specifying the lats and longs like this example:
http://matplotlib.sourceforge.net/basemap/doc/html/users/geography.html
And you can use the method: drawcontries() to draw the country boundries, but all the countries are in the same colour. Does anyone know how to highlight a specific country? Thanks in advance.

Eric
-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________ Matplotlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/E/MU/P d+(-) s: a- C++ UL$ P+>++ L++ E++ W++ N+ o+>++ K+++ w !O
M-(+) V-- PS+ PE+ Y+ PGP++ t? 5? X? R+>* tv@ b++++ DI-- D G++ e++>+++@ h*
r !y+
------END GEEK CODE BLOCK------

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...