KURT PETERS wrote: > I'm trying what I thought was a simple test and getting "bad" results. I am > taking some lat long coords, and feeding it into a map. The conversion is > not giving "real" values that can be plotted on a map (and actually produces > an error when I use annotate). > I'm including the simple code and the output: > >>>>>>>>>> CODE<<<<<<<<<<<<<<< >>>>>>>>>> > import pylab as p > import numpy > from matplotlib.toolkits.basemap import Basemap as Basemap > from matplotlib.colors import rgb2hex > from matplotlib.patches import Polygon > > # Lambert Conformal map of lower 48 states. > # create new figure > fig=p.figure() > m1 = Basemap(llcrnrlon=-119,llcrnrlat=22,urcrnrlon=-64,urcrnrlat=49,\ > > projection='ortho',lat_1=33,lat_2=45,lon_0=-95,lat_0=40,resolution='c') > > > #COS > #D + M/60 + S/3600 > COSLat=38+56.0/60.0+0.013 > COSLon=-1*(104+48.0/60.0) > WASHLat=38+53.0/60.0+23.0/3600.0 > WASHLon=-1*(77+32.0/3600.0) > > print COSLat > x, y = m1(COSLat,COSLon) > print 'x =%f, y=%f' % (x,y) > > m1.plot([x],[y],'ko') > ax=p.gca() > ax.annotate('COS1',(COSLat,COSLon)) > #ax.annotate('COS2',(x,y)) > ax.annotate('Wash1',(WASHLat,WASHLon)) > x, y = m1(WASHLat,WASHLon) > #ax.annotate('Wash2',(x,y)) > > m1.drawcoastlines() > m1.fillcontinents() > m1.drawcountries() > m1.drawstates() > m1.drawparallels(numpy.arange(25,65,4),labels=[1,0,0,0]) > m1.drawmeridians(numpy.arange(-120,-40,4),labels=[0,0,0,1]) > p.title('full resolution') > p.show() > <<<<<<<<<Output>>>>>>>>>>> > 38.9463333333 > x =1000000000000000000000000000000.000000, > y=1000000000000000000000000000000.000000 > > Regards, > Kurt > >
Kurt: If you want the Lambert conformal projection, you should use projection='lcc', not 'ortho'. Nevertheless, your example works for me if I change the order of the arguments passed to the Basemap instance to x, y = m1(COSLon,COSLat) x, y = m1(WASHLon,WASHLat) Note, longitude goes first. Also, if you want 'full resolution' coastlines, use resolution='h'. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449 325 Broadway Boulder, CO, USA 80305-3328 ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users