Re: [Matplotlib-users] Background basemaps in Basemap
On Sun, Aug 26, 2012 at 12:18 AM, Jeff Whitaker wrote: > Klo: The image in interpolated to the Basemap projection region. This is > slow - the main reason to use the WMS is to avoid this by having it done on > the server side. All right, that's the right way anyway > The trick is to figure out what the EPSG projection code is based on the > Basemap projection info, and pass that information to the WMS server so it > can do the interpolation. Yes, and also to pass right `size` parameter as aspect ratio needs to be correct Do you want me to try to pair both projections (Basemap name and WKID and WKT as they call it)? > Here's an example for south polar stereographic: > > width = 12000.e3 > plt.figure() > basemap_url =\ > "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export?\ > bbox=%d,%d,%d,%d&\ > bboxSR=3412&\ > imageSR=3412&\ > size=800,800&\ > dpi=128&\ > format=png32&\ > f=image" % (-width/2,-width/2,width/2,width/2) > m =\ > Basemap(projection='stere',resolution='i',lon_0=0,lat_0=-90,lat_ts=-70,\ > width=width,height=width,rsphere=(6378273,6356889.449)) > m.imshow(plt.imread(urllib2.urlopen(basemap_url)),origin='upper') > m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1],color='y') > m.drawparallels(np.arange(-80,-0,10),labels=[1,0,0,0],color='y') > m.drawcoastlines() > plt.show() > Looks beautifully :) As said later today I'll look at Nokia maps and then will try to look for WMS servers. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
> As said later today I'll look at Nokia maps and then will try to look > for WMS servers. Nokia map services are OK, and can be used even without applying for free account, but they brand every map with their logo even for professional licence. REST services (http://api.maps.nokia.com/en/restmaps/overview.html) are very limited, in one projection and mapped according central point instead bounding box. They offer (http://api.maps.nokia.com/en/index.html) other approaches like JS, JAVA, HTML5 and perhaps some more advanced service can be deduced from there in Python, but it's not worth perhaps. BTW I checked one WMS server (http://wms.jpl.nasa.gov/wms.cgi?request=GetCapabilities). It has tiling service (GetTileService) and mapping service (GetMap) but only in standard projection EPSG:4326 Here are maps provided: 1 - WMS Global Mosaic, pan sharpened 2 - WMS Global Mosaic, not pan sharpened 3 - CONUS mosaic of 1990 MRLC dataset 4 - SRTM reflectance magnitude, 30m 5 - Current global view of the earth, morning 6 - Current global view of the earth in the afternoon 7 - Blue Marble Next Generation, Global MODIS derived image 8 - Blue Marble, Global MODIS derived image 9 - SRTM derived global elevation, 3 arc-second, hue mapped 10 - Global 1km elevation, seamless SRTM land elevation and ocean depth 11 - SRTM derived global elevation, 3 arc-second 12 - United States elevation, 30m 13 - Digital Elevation Map of the United States, DTED dataset, 3 second resolution, grayscale 14 - Digital Elevation Map of the United States, DTED dataset, 3 second resolution, hue mapped 15 - ASTER DEM, tiled only, 1.5 arc-second per pixel Only first two offer international locations (from Landsat) -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] basemap via macports [solved]
Indeed I was running Apple Python instead of macport. Thanks for all that pointed it out. best Carlos On Fri, Aug 24, 2012 at 11:46 AM, Carlos Grohmann wrote: > Hello all, > > I just did a fresh macports install, and installed > py27-matplotlib-basemap, so all dependencies were installed as well. > > After installing python, I did run port-select (or something like it) to > make sure I'm using macports python. > > My problem is that I can't run it: > > > GuanoMac:~ guano$ python > Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> from mpl_toolkits.basemap import Basemap > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named basemap > > > Anyone experienced in this kind of installation could share hints? > > tks > > Carlos > > -- > Prof. Carlos Henrique Grohmann > Institute of Geosciences - Univ. of São Paulo, Brazil > - Digital Terrain Analysis | GIS | Remote Sensing - > > http://carlosgrohmann.com > > Can’t stop the signal. > > -- Prof. Carlos Henrique Grohmann Institute of Geosciences - Univ. of São Paulo, Brazil - Digital Terrain Analysis | GIS | Remote Sensing - http://carlosgrohmann.com Can’t stop the signal. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Background basemaps in Basemap
On 8/26/12 5:44 AM, klo uo wrote: > On Sun, Aug 26, 2012 at 12:18 AM, Jeff Whitaker wrote: >> Klo: The image in interpolated to the Basemap projection region. This is >> slow - the main reason to use the WMS is to avoid this by having it done on >> the server side. > All right, that's the right way anyway > > >> The trick is to figure out what the EPSG projection code is based on the >> Basemap projection info, and pass that information to the WMS server so it >> can do the interpolation. > Yes, and also to pass right `size` parameter as aspect ratio needs to be > correct > Do you want me to try to pair both projections (Basemap name and WKID > and WKT as they call it)? Klo: Since epsg codes comprise a very small subset of possible Basemap projections, it may be better to just allow Basemap to accept an epsg kwarg. That keyword would be required in order to use a WMS to display a map background. This may be tricky though, since Basemap needs more information to define a map projection region than is provided by the epsg code. We may have to start with just a few supported epsg codes and then add more as necessary. I added a testwms.py example to my fork (https://github.com/jswhit/basemap.git) that shows how to use three different map projections (epsg codes). -Jeff -Jeff > > >> Here's an example for south polar stereographic: >> >> width = 12000.e3 >> plt.figure() >> basemap_url =\ >> "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export?\ >> bbox=%d,%d,%d,%d&\ >> bboxSR=3412&\ >> imageSR=3412&\ >> size=800,800&\ >> dpi=128&\ >> format=png32&\ >> f=image" % (-width/2,-width/2,width/2,width/2) >> m =\ >> Basemap(projection='stere',resolution='i',lon_0=0,lat_0=-90,lat_ts=-70,\ >> width=width,height=width,rsphere=(6378273,6356889.449)) >> m.imshow(plt.imread(urllib2.urlopen(basemap_url)),origin='upper') >> m.drawmeridians(np.arange(-180,180,30),labels=[0,0,0,1],color='y') >> m.drawparallels(np.arange(-80,-0,10),labels=[1,0,0,0],color='y') >> m.drawcoastlines() >> plt.show() >> > Looks beautifully :) > > As said later today I'll look at Nokia maps and then will try to look > for WMS servers. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Install error on Mac OS X 10.8 (mountain lion): ft2build.h
Hi, I'm having trouble installing matplotlib on my Mac OS X mountain lion (10.8). See my output below. Note two things: 1. The error is "predicted" by freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/local/include', '/usr/include', * '/usr/X11/include', '/usr/local/include', * '/usr/include', '.', * '/usr/local/include/freetype2', * '/usr/include/freetype2', * '/usr/X11/include/freetype2', * '/usr/local/include/freetype2', * '/usr/include/freetype2', './freetype2'. even though I have pkg-config installed via "brew install pkg-config" 2. For some reason, the installer cannot find "ft2build.h". To the best of my knowledge, this file is not on my machine: In file included from src/ft2font.cpp:3: src/ft2font.h:16:10: fatal error: 'ft2build.h' file not found #include ^ 1 error generated. I have installed pkg-config via "brew install pkg-config", and "brew doctor" gives me no issues. I installed matplotlib via the command: sudo pip install git+ https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev Does anyone know what might be the issue here? I had no problems on OS X 10.7... Thanks, Tim Here's the full log message: Downloading/unpacking matplotlib-dev from git+ https://github.com/matplotlib/matplotlib.git Running setup.py egg_info for package matplotlib-dev basedirlist is: ['/usr/local/', '/usr', '/usr/X11'] BUILDING MATPLOTLIB matplotlib: 1.2.x python: 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.6.1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '/usr/local/include', '/usr/include', * '/usr/X11/include', '/usr/local/include', * '/usr/include', '.', * '/usr/local/include/freetype2', * '/usr/include/freetype2', * '/usr/X11/include/freetype2', * '/usr/local/include/freetype2', * '/usr/include/freetype2', './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of * '/usr/local/include', '/usr/include', * '/usr/X11/include', '/usr/local/include', * '/usr/include', '.' Tkinter: Tkinter: version not identified, Tk: 8.5, Tcl: 8.5 Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to "import gtk" in your build/install environment Mac OS X native: yes Qt: no Qt4: no PySide: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES dateutil: 1.5 pytz: matplotlib will provide adding pytz OPTIONAL USETEX DEPENDENCIES dvipng: no ghostscript: /bin/sh: gs: command not found latex: no [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor', 'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib.delaunay', 'pytz'] warning: no files found matching 'KNOWN_BUGS' warning: no files found matching 'INTERACTIVE' warning: no files found matching 'MANIFEST' warning: no files found matching '__init__.py' warning: no files found matching 'examples/data/*' warning: no files found matching 'lib/mpl_toolkits' warning: no files found matching 'lib/matplotlib/mpl-data/matplotlib.conf' warning: no files found matching 'lib/matplotlib/mpl-data/matplotlib.conf.template' warning: no files found matching 'LICENSE*' under directory 'license' Installing collected packages: matplotlib-dev Running setup.py install
Re: [Matplotlib-users] Install error on Mac OS X 10.8 (mountain lion): ft2build.h
Hi, It turns out I was missing two packages: freetype and libpng. These could be downloaded as brew install freetype brew install libpng I thought I had done this... I may have re-installed pkg-config via brew as well. I'm not sure why I was unable to google this After making these changes I had no problem installing the development version of matplotlib. Thanks, Tim On Sun, Aug 26, 2012 at 5:41 PM, Timothy Duly wrote: > Hi, > > I'm having trouble installing matplotlib on my Mac OS X mountain lion > (10.8). > > See my output below. Note two things: > > 1. The error is "predicted" by > > freetype2: found, but unknown version (no pkg-config) > * WARNING: Could not find 'freetype2' headers in > any > * of '/usr/local/include', '/usr/include', > * '/usr/X11/include', '/usr/local/include', > * '/usr/include', '.', > * '/usr/local/include/freetype2', > * '/usr/include/freetype2', > * '/usr/X11/include/freetype2', > * '/usr/local/include/freetype2', > * '/usr/include/freetype2', './freetype2'. > > even though I have pkg-config installed via "brew install pkg-config" > > 2. For some reason, the installer cannot find "ft2build.h". To the best > of my knowledge, this file is not on my machine: > In file included from src/ft2font.cpp:3: > > src/ft2font.h:16:10: fatal error: 'ft2build.h' file not found > > #include > > ^ > > 1 error generated. > > I have installed pkg-config via "brew install pkg-config", and "brew > doctor" gives me no issues. I installed matplotlib via the command: > > sudo pip install git+ > https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev > > Does anyone know what might be the issue here? I had no problems on OS X > 10.7... > > Thanks, > Tim > > > Here's the full log message: > > Downloading/unpacking matplotlib-dev from git+ > https://github.com/matplotlib/matplotlib.git > Running setup.py egg_info for package matplotlib-dev > basedirlist is: ['/usr/local/', '/usr', '/usr/X11'] > > > BUILDING MATPLOTLIB > matplotlib: 1.2.x > python: 2.7.2 (default, Jun 20 2012, 16:23:33) [GCC > 4.2.1 > Compatible Apple Clang 4.0 > (tags/Apple/clang-418.0.60)] > platform: darwin > > REQUIRED DEPENDENCIES > numpy: 1.6.1 > freetype2: found, but unknown version (no pkg-config) > * WARNING: Could not find 'freetype2' headers > in any > * of '/usr/local/include', '/usr/include', > * '/usr/X11/include', '/usr/local/include', > * '/usr/include', '.', > * '/usr/local/include/freetype2', > * '/usr/include/freetype2', > * '/usr/X11/include/freetype2', > * '/usr/local/include/freetype2', > * '/usr/include/freetype2', './freetype2'. > > OPTIONAL BACKEND DEPENDENCIES > libpng: found, but unknown version (no pkg-config) > * Could not find 'libpng' headers in any of > * '/usr/local/include', '/usr/include', > * '/usr/X11/include', '/usr/local/include', > * '/usr/include', '.' >Tkinter: Tkinter: version not identified, Tk: 8.5, Tcl: > 8.5 > Gtk+: no > * Building for Gtk+ requires pygtk; you must > be able > * to "import gtk" in your build/install > environment >Mac OS X native: yes > Qt: no >Qt4: no > PySide: no > Cairo: no > > OPTIONAL DATE/TIMEZONE DEPENDENCIES > dateutil: 1.5 > pytz: matplotlib will provide > adding pytz > > OPTIONAL USETEX DEPENDENCIES > dvipng: no >ghostscript: /bin/sh: gs: command not found > latex: no > > [Edit setup.cfg to suppress the above messages] > > > pymods ['pylab'] > packages ['matplotlib', 'matplotlib.backends', > 'matplotlib.backends.qt4_editor', 'matplotlib.projections', > 'matplotlib.testing', 'matplotlib.testing.jpl_units', 'matplotlib.tests', > 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', > 'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', > 'matplotlib.sphinxext', 'matplotlib.tri', 'matplotlib
Re: [Matplotlib-users] Background basemaps in Basemap
On Sun, Aug 26, 2012 at 9:56 PM, Jeff Whitaker wrote: > Klo: Since epsg codes comprise a very small subset of possible Basemap > projections, it may be better to just allow Basemap to accept an epsg kwarg. > That keyword would be required in order to use a WMS to display a map > background. This may be tricky though, since Basemap needs more information > to define a map projection region than is provided by the epsg code. We may > have to start with just a few supported epsg codes and then add more as > necessary. > > I added a testwms.py example to my fork > (https://github.com/jswhit/basemap.git) that shows how to use three > different map projections (epsg codes). I'm not sure if I understand projection problem, as arcgis webservice provides thousands of projections, but then you know better. I thought that the code will be just one function which would accept Map name, then coordinates and projection code will be deduced from Basemap function initiation? Here is same server from agency where you work according your signature: maps.ngdc.noaa.gov/rest/services it provides additional maps on same server as arcgis I also checked many WMS servers, first with XML editor but then with Gaia, which was excellent help in determining that many WMS servers just return their capabilities, but does not provide service as described in capabilities response. Some offer tilling features, for possible future interactive zooming in Basemap ;) Here is one http://maps.dwd.de/geoserver/wms?request=GetCapabilities&service=WMS&version=1.1.1 which offers bluemarble in many projection. Additionally it offers some German datasets, but does not offer tilling service. Perhaps we could look just for servers with get map service but also tilling support and support for various projections. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users