Re: [Matplotlib-users] Basemap to KML polygon

2008-07-23 Thread Lionel Roubeyrie
Hi Tim,
like I said, I want to convert a filled contours map generated with 
Basemap (example here : http://imagebin.ca/view/3nYnN3.html)
to a polygon shapefile (vector). The filled contours are from a regular 
points grid which can already be saved into a point shapefile (via ogr 
python bindings)
and I use QGIS to render it. Now I search to get the filled result into 
a shp file to pass it through ogr2ogr -f KML and render it with 
GoogleEarth.
I know I can do all this process with the QGIS-GRASS interface, but I 
must limit softwares dependencies 'cause it'll be placed on a web 
server, and I think Python it's the best choice for doing that :-)
After multiple tests, I can retrieve the polygons points coordinates via 
matplotlib.Patch and save them in a shp file. Now I have troubles with 
real coordinates and meta-datas, but nothing impossible :-)

Tim Michelsen a écrit :
 Looks like I've done a mistake with my last post, sorry Eli...
 I know how to save datas to a shapefile with the OGR library but only 
 for points datas.
 


   
 I'll appreciate if somebody can point me how to save a filled contour 
 map basemap into a polygon shapefile, can't find any example with google.
 
 What do you really want to save here?
 A basemap with a contour surface overlayed can be viewed as a assembly 
 of various layers. So this is like the result of the gis operations when 
 you launch the map composer to finish your map.

 If you want to create a raster file from the contour part plotted over a 
 basemap I think the python bindings of gdal will get you started.
 http://pypi.python.org/pypi/GDAL/
 I succeded into writing a tiff file from a gdal array.

 I don't know how to write a vector file from python with ogr or shapely. 
   But these questions are better to be asked on the gdal list.:

 So about interpolating to a contour look at shapely. Writing should be 
 accomplished with ogr.

 That said, I only have testing experience with writing geodata with 
 python.

 The overkill may be to invoke the respective GRASS command by a script.

 I would appreciate if you would tell us what you use by the end.

 Kind regards,
 Timmie


 When it comes to python and GIS the first stop seems to be:

 * http://gispython.org/
 * http://lists.gispython.org/mailman/listinfo/community

 Some more links:
 * http://de.giswiki.net/wiki/Kategorie:Python
 * http://de.giswiki.net/wiki/WorldMill
 * http://zcologia.com/news/750/keytree/
 * http://sgillies.net/


 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 Build the coolest Linux based applications with Moblin SDK  win great prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


   

-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr




-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap to KML polygon

2008-07-23 Thread Scott Sinclair
 Lionel Roubeyrie [EMAIL PROTECTED] 07/23/08 9:37 AM 
I want to convert a filled contours map generated with 
Basemap (example here : http://imagebin.ca/view/3nYnN3.html)
to a polygon shapefile (vector). 

After multiple tests, I can retrieve the polygons points coordinates via 
matplotlib.Patch and save them in a shp file. Now I have troubles with 
real coordinates and meta-datas, but nothing impossible :-)


Hi,

If you're after a 'quick and dirty' solution.

As I understand it a KML file can be used to specify the Latitude and Longitude 
extent of a raster image (See 'Ground Overlays' at 
http://code.google.com/apis/kml/documentation/kml_tut.html). If you can accept 
some distortion of the text on your image (should be small with a small region) 
and can work out the size of each pixel in degrees of lat and lon, then all you 
need to do is write a simple text file to specify where Google Earth should 
display your Basemap contour map.

What you're doing does sound more elegant, but more complex.

Regards,
Scott



Please find our Email Disclaimer here: http://www.ukzn.ac.za/disclaimer/

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scaling--I couldn't find it, but should this be in FAQ list?

2008-07-23 Thread Jonathan Hayward http://JonathansCorner.com
On Tue, Jul 22, 2008 at 4:54 PM, John Hunter [EMAIL PROTECTED] wrote:

 On Tue, Jul 22, 2008 at 4:06 PM, Jonathan Hayward
 http://JonathansCorner.com [EMAIL PROTECTED] wrote:
  Thank you; I've shrunk the graphic part.

 Please respond to the mailing list (reply to all)


Oops; sorry.



  When I save it as an image, it's painting an 800x600 image, so I've
 shrunk
  the portion of the 800x600 image I'm using. Is there a way to crop or do
  something comparable?

 Not sure I understand the question.  You can control the figure size
 in pixels by setting the figure size in inches and the dpi -- the
 pixel size is the prodict of the two

  fig = figure((8,6), dpi=100)  # 800x600


When I tried placing that line in a couple of places, I got an error:

[EMAIL PROTECTED] ~/bin $ ./barchart
Traceback (most recent call last):
  File ./barchart, line 6, in ?
fig = figure((8,6), dpi=100)
  File /usr/lib/python2.4/site-packages/matplotlib/pyplot.py, line 186, in
figure
FigureClass=FigureClass,
  File
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py,
line 44, in new_figure_manager
return FigureManagerGTKAgg(canvas, num)
  File
/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py, line
405, in __init__
self.window.set_title(Figure %d % num)
TypeError: not all arguments converted during string formatting

Are there other things it needs? (I tried placing a space so 8,6 would
read 8, 6, but it didn't significantly change the error.)


 you can control the *relative* proportion of the axes by using the
 axes command as before

  ax = axes([left, bottom, width, height])

 with these two, you should be able to get whatever size and
 proportions you want.

 JDH




-- 
-- Jonathan Hayward, [EMAIL PROTECTED]

** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

++ Would you like to curl up with one of my hardcover books?
++ You can now get my books from http://CJSHayward.com
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Scaling--I couldn't find it, but should this be in FAQ list?

2008-07-23 Thread John Hunter
On Wed, Jul 23, 2008 at 9:06 AM, Jonathan Hayward http://JonathansCorner.com
  fig = figure((8,6), dpi=100)  # 800x600

 When I tried placing that line in a couple of places, I got an error:

Sorry, my fault, you need the keyword argument figsize:


In [1]: import matplotlib.pyplot as plt

In [2]: fig = plt.figure(figsize=(8,6), dpi=100)  # 800x600

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Border appearance

2008-07-23 Thread Jonathan Hayward http://JonathansCorner.com
On Tue, Jul 22, 2008 at 4:57 PM, John Hunter [EMAIL PROTECTED] wrote:

 On Tue, Jul 22, 2008 at 4:28 PM, Jonathan Hayward
 http://JonathansCorner.com [EMAIL PROTECTED] wrote:
  On the two routines I'm modifying from examples, boundaries and borders
 are
  generally a hefty black.
 
  How can I control color and/or thickness and/or turn off items like
  boundaries that are drawn in black?

 There are two borders in question, the figure border and the axes
 border.  Both are rectangle instances.  You can control the figure
 border with the figurePatch instance


How do I query/set the figure in question?

I was specifying the axes earlier, and setting a linewidth of 0 seemed to
remove one of two borders (or, from a non-technical perspective, made the
border half as thick). See before.png and after.png: getting closer at
least...


 fig.figurePatch.set_edgecolor('white')
 fig.figurePatch.set_linewidth(0.5)

 and similarly for the axes axesFrame instance

 ax = axes([left, bottom, width, height])
 ax.axesFrame.set_edgecolor('red')
 ax.axesFrame.set_linewidth(0.5)

 You can make the frame invisible in a few different ways:

  * set the edgecolor to be the same as the face color
  * set the linewidth to 0
  * set the visible property to False (ax.axesFrame.set_visible(False))

 JDH




-- 
-- Jonathan Hayward, [EMAIL PROTECTED]

** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

++ Would you like to curl up with one of my hardcover books?
++ You can now get my books from http://CJSHayward.com
attachment: before.pngattachment: after.png-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Basemap to KML polygon

2008-07-23 Thread Lionel Roubeyrie
thanks for this link Scott, I went into the refernce API directly 
without looking at this tutorial. Effectively, it works :-)

Scott Sinclair a écrit :
 Lionel Roubeyrie [EMAIL PROTECTED] 07/23/08 9:37 AM 
 
 I want to convert a filled contours map generated with 
 Basemap (example here : http://imagebin.ca/view/3nYnN3.html)
 to a polygon shapefile (vector). 

 After multiple tests, I can retrieve the polygons points coordinates via 
 matplotlib.Patch and save them in a shp file. Now I have troubles with 
 real coordinates and meta-datas, but nothing impossible :-)
   

 Hi,

 If you're after a 'quick and dirty' solution.

 As I understand it a KML file can be used to specify the Latitude and 
 Longitude extent of a raster image (See 'Ground Overlays' at 
 http://code.google.com/apis/kml/documentation/kml_tut.html). If you can 
 accept some distortion of the text on your image (should be small with a 
 small region) and can work out the size of each pixel in degrees of lat and 
 lon, then all you need to do is write a simple text file to specify where 
 Google Earth should display your Basemap contour map.

 What you're doing does sound more elegant, but more complex.

 Regards,
 Scott



 Please find our Email Disclaimer here: http://www.ukzn.ac.za/disclaimer/

 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
 Build the coolest Linux based applications with Moblin SDK  win great prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


   

-- 
Lionel Roubeyrie - [EMAIL PROTECTED]
Chargé d'études et de maintenance
LIMAIR - la Surveillance de l'Air en Limousin
http://www.limair.asso.fr




-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users