id summary reporter owner description type status priority milestone component version severity resolution keywords cc 3409 BSB format: use correct +lat_ts value for MERCATOR from KNP/PP= hamish warmerdam "Hi, trunk/frmts/bsb/bsbdataset.cpp has: {{{ /* -------------------------------------------------------------------- */ /* Can we derive a reasonable coordinate system definition for */ /* this file? For now we keep it simple, just handling */ /* mercator. In the future we should consider others. */ /* -------------------------------------------------------------------- */ }}} (the above should really be on the frmt's help page) {{{ else if( EQUALN(pszPR,""PR=MERCATOR"", 11) ) { // We somewhat arbitrarily select our first GCPX as our // central meridian. This is mostly helpful to ensure // that regions crossing the dateline will be contiguous // in mercator. }}} Instead of using the first REF/ point, this should be using the PP= value in the KNP= section of the header. ---- thus ends the bug report and begins the RFE: ---- Likewise, for TRANSVERSE MERCATOR the PP= value represents the +lon_0 term. I haven't figured out yet what the secondary terms for tmerc and LAMBERT CONFORMAL CONIC will be, mostly because I haven't found a NOAA chart which uses them yet. Here are some observations: I am thinking that the KNQ/P1= P2= P3= P4= variables must be there for the other projection definition terms. Looking at NOAA chart 12300 as a random sample, * For mercator, KNQ/P2= is the same as PP= at 40.0, which will be +lat_ts. This matches what is printed along with the map title if I view the .KAP file in QGIS. For reference, here's it in context: {{{ KNP/SC=400000,GD=NAD83,PR=MERCATOR,PP=40.000,PI=30.000,SP=,SK=0.0000000 TA=90.0000000,UN=FATHOMS,SD=MEAN LOWER LOW WATER,DX=40.00,DY=40.00 KNQ/EC=RF,GD=NARC,VC=UNKNOWN,SC=MLLW,PC=MC,P1=UNKNOWN,P2=40.000 P3=NOT_APPLICABLE,P4=NOT_APPLICABLE,GC=NOT_APPLICABLE,RM=INVERSE }}} I think KNP/PI= has something to do with roughly how much distance 1 pixel covers, anyway here is a scale : PI ratio for a number of NOAA charts: {{{ SC=400000,PI=30.000 SC=80000,PI=10.000 SC=40000,PI=5.000 SC=15000,PI=1.000 SC=10000,PI=1.000 }}} perhaps that's (mean_extent / dpi*0.0254) ??? shrug here is an example of +proj=poly from NOAA chart 14500: {{{ KNP/SC=1500000,GD=NAD83,PR=POLYCONIC,PP=-83.814,PI=60.000,SP=,SK=359.8576421 TA=89.8576421,UN=FATHOMS,SD=GREAT LAKES LOW WATER,DX=150.00,DY=150.00 KNQ/EC=RF,GD=NARC,VC=UNKNOWN,SC=GLLW,PC=PH,P1=-83.814,P2=UNKNOWN P3=NOT_APPLICABLE,P4=NOT_APPLICABLE,GC=NOT_APPLICABLE,RM=INVERSE }}} (PP= P1= +lon_0, and PC=PH) I'm using the GPL OpenCPN.org software for tests vs. the GDAL code, both that only handles +proj=merc right now as well. a little more info at http://libbsb.sourceforge.net/bsb_file_format.html and by reading the c++ code of mc2bsbh ver 0.0.9: (GPL3) http://www.dacust.com/inlandwaters/mapcal/index.html I'm still searching for any NOAA lcc and tmerc charts to understand them. Hamish " defect closed normal GDAL_Raster svn-trunk normal fixed bsb chrisbarker manimaul