Changes between Version 1 and Version 2 of FAQ

Show
Ignore:
Timestamp:
05/15/08 21:27:07 (5 years ago)
Author:
warmerdam
Comment:

full pass.

Legend:

Unmodified
Added
Removed
Modified
  • FAQ

    v1 v2  
    3333A default build and install on Unix will normally build knowledge of the directory where the grid shift files are installed into the PROJ.4 library (usually /usr/local/share/proj).  On Windows the library is normally built thinking that C:\PROJ\NAD is the installed directory for the grid shift files. If the built in concept of the PROJ.4 data directory is incorrect, the PROJ_LIB environment can be defined with the correct directory. 
    3434 
    35 <h2><a name="nad2783_debug">How do I debug problems with NAD27/NAD83 datum shifting?</a></h2> 
     35== How do I debug problems with NAD27/NAD83 datum shifting? == 
    3636 
    37 <ol> 
    38 <li> Verify that you have the binary files (eg. /usr/local/share/proj/conus) 
    39 installed on your system.  If not, see the previous question. 
    40 <p> 
    41 <li> Try a datum shifting operation in relative isolation, such as with the 
    42 cs2cs command listed above.  Do you get reasonable results?  If not it is 
    43 likely the grid shift files aren't being found.  Perhaps you need to define 
    44 PROJ_LIB? <p> 
     37 * Verify that you have the binary files (eg. /usr/local/share/proj/conus) installed on your system.  If not, see the previous question. 
     38 * Try a datum shifting operation in relative isolation, such as with the cs2cs command listed above.  Do you get reasonable results?  If not it is likely the grid shift files aren't being found.  Perhaps you need to define PROJ_LIB? 
     39 * The cs2cs command and the underlying pj_transform() API know how to do a grid shift as part of a more complex coordinate transformation; however, it is imperative that both the source and destination coordinate system be defined with appropriate datum information.  That means that implicitly or explicitly there must be a +datum= clause, a +nadgrids= clause or a +towgs84= clause.  For instance "cs2cs +proj=latlong +datum=NAD27 +to +proj=latlong +ellps=WGS84" won't work because defining the output coordinate system as using the ellipse WGS84 isn't the same as defining it to use the datum WGS84 (use +datum=WGS84).  If either the input or output are not identified as having a datum, the datum shifting (and ellipsoid change) step is just quietly skipped! 
     40 * The PROJ_DEBUG environment can be defined (any value) to force extra output from the PROJ.4 library to stderr (the text console normally) with information on what data files are being opened and in some cases why a transformation fails. Note that PROJ_DEBUG support is not yet very mature in the PROJ.4 library. 
     41 * The "-v" flag to cs2cs can be useful in establishing more detail on what parameters being used internally for a coordinate system.  This will include expanding the definition of +datum clause. 
    4542 
    46 <li> The cs2cs command and the underlying pj_transform() API know how to  
    47 do a grid shift as part of a more complex coordinate transformation; however, 
    48 it is imperative that both the source and destination coordinate system be 
    49 defined with appropriate datum information.  That means that implicitly or 
    50 explicitly there must be a +datum= clause, a +nadgrids= clause or 
    51 a +towgs84= clause.  For instance "cs2cs +proj=latlong +datum=NAD27 +to  
    52 +proj=latlong +ellps=WGS84" won't work because defining the output coordinate  
    53 system as using the ellipse WGS84 isn't the same as defining it to use the 
    54 datum WGS84 (use +datum=WGS84).  If either the input or output are not  
    55 identified as having a datum, the datum shifting (and ellipsoid change) step 
    56 is just quietly skipped!<p> 
     43== How do I use EPSG coordinate system codes with PROJ.4? == 
    5744 
    58 <li> The PROJ_DEBUG environment can be defined (any value) to force extra  
    59 output from 
    60 the PROJ.4 library to stderr (the text console normally) with information on 
    61 what data files are being opened and in some cases why a transformation fails. 
    62 Note that PROJ_DEBUG support is not yet very mature in the PROJ.4 library.<p> 
     45There is somewhat imperfect translation between 2d geographic and projected coordinate system codes and PROJ.4 descriptions of the coordinate system available in the epsg definition file that normally lives in the proj/nad directory.  If installed (it is installed by default on Unix), it is possible to use EPSG numbers like this: 
    6346 
    64 <li> The "-v" flag to cs2cs can be useful in establishing more detail on  
    65 what parameters being used internally for a coordinate system.  This will 
    66 include expanding the definition of +datum clause. <p> 
    67  
    68 </ol> 
    69  
    70 <!--------------------------------------------------------------------------> 
    71  
    72 <h2><a name="epsg">How do I use EPSG coordinate system codes with PROJ.4?</a></h2> 
    73  
    74 There is somewhat imperfect translation between 2d geographic and 
    75 projected coordinate system codes and PROJ.4 descriptions of the 
    76 coordinate system available in the <tt>epsg</tt> definition file that 
    77 normally lives in the <tt>proj/nad</tt> directory.  If installed (it is 
    78 installed by default on Unix), it is possible to use EPSG numbers like this: 
    79  
    80 <pre> 
     47{{{ 
    8148% cs2cs -v +init=epsg:26711 
    8249# ---- From Coordinate System ---- 
     
    9259# 
    9360# +proj=latlong +datum=NAD27 +ellps=clrk66 +nadgrids=conus,ntv1_can.dat 
    94 </pre> 
     61}}} 
    9562 
    96 The <tt>proj/nad/epsg</tt> file can be browsed and searched in a text editor  
    97 for coordinate systems.  There are known to be problems with some coordinate 
    98 systems, and any coordinate systems with odd axes, a non-greenwich prime 
    99 meridian or other quirkyness are unlikely to work properly.  Caveat Emptor!<p> 
     63The proj/nad/epsg file can be browsed and searched in a text editor for coordinate systems.  There are known to be problems with some coordinate systems, and any coordinate systems with odd axes, a non-greenwich prime meridian or other quirkyness are unlikely to work properly.  Caveat Emptor! 
    10064 
    101 <!--------------------------------------------------------------------------> 
     65== How do I use 3 parameter and 7 parameter datum shifting == 
    10266 
    103 <h2><a name="datum_37">How do I use 3 parameter and 7 parameter datum shifting</a></h2> 
     67Datum shifts can be approximated with 3 and 7 parameter transformations.  Their use is more fully described in the <a href="gen_parms.html#towgs84">towgs84</a> discussions. 
    10468 
    105 Datum shifts can be approximated with 3 and 7 parameter transformations.   
    106 Their use is more fully described in the  
    107 <a href="gen_parms.html#towgs84">towgs84</a> discussions.<p> 
     69== Does PROJ.4 work in different international numeric locales? == 
    10870 
     71No.  PROJ.4 makes extensive use of sprintf() and atof() internally to translate numeric values.  If a locale is in effect that modifies formatting of numbers, altering the role of commas and periods in numbers, then PROJ.4 will not work.  This problem is common in some European locales. 
    10972 
    110 <!--------------------------------------------------------------------------> 
    111  
    112 <h2><a name="locale">Does PROJ.4 work in different international numeric locales?</a></h2> 
    113  
    114 No.  PROJ.4 makes extensive use of sprintf() and atof() internally to translate 
    115 numeric values.  If a locale is in effect that modifies formatting of  
    116 numbers, altering the role of commas and periods in numbers, then PROJ.4 
    117 will not work.  This problem is common in some European locales.<p> 
    118  
    119 On unix-like platforms, this problem can be avoided by forcing the use 
    120 of the default numeric locale by setting the LC_NUMERIC environment variable 
    121 to C. <p> 
     73On unix-like platforms, this problem can be avoided by forcing the use of the default numeric locale by setting the LC_NUMERIC environment variable to C.  
    12274 
    12375eg. 
    124 <pre> 
     76{{{ 
    12577$ export LC_NUMERIC=C 
    12678$ proj ... 
    127 </pre> 
     79}}} 
    12880 
    129 <!--------------------------------------------------------------------------> 
     81== Changing Ellipsoid / Why can't I convert from WGS84 to Virtual Earth Mercator? == 
    13082 
    131 <h2><a name="sphere_as_wgs84">Changing Ellipsoid / Why can't I convert from WGS84 to Virtual Earth Mercator?</a></h2> 
     83The coordinate system definition for Virtual Earth Mercator is as follows, which uses a sphere as the earth model for the mercator projection.  
    13284 
    133 The coordinate system definition for Virtual Earth Mercator is as follows,  
    134 which uses a sphere as the earth model for the mercator projection.  
    135  
    136 <pre> 
     85{{{ 
    13786+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0  
    13887     +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs 
    139 </pre> 
     88}}} 
    14089 
    14190But, if you do something like: 
    14291 
    143 <pre> 
     92{{{ 
    14493cs2cs +proj=latlong +datum=WGS84  
    14594    +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0  
    14695                   +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs 
    147 </pre> 
     96}}} 
    14897 
    149 to convert between WGS84 and mercator on the sphere there will be substantial 
    150 shifts in the Y mercator coordinates.  This is because internally cs2cs is 
    151 having to adjust the lat/long coordinates from being on the sphere to being 
    152 on the WGS84 datum which has a quite differently shaped ellipsoid.<p> 
     98to convert between WGS84 and mercator on the sphere there will be substantial shifts in the Y mercator coordinates.  This is because internally cs2cs is having to adjust the lat/long coordinates from being on the sphere to being on the WGS84 datum which has a quite differently shaped ellipsoid. 
    15399 
    154 In this case, and many other cases using spherical projections, the desired 
    155 approach is to actually treat the lat/long locations on the sphere as if  
    156 they were on WGS84 without any adjustments when using them for converting 
    157 to other coordinate systems.  The solution is to "trick" PROJ.4 into applying 
    158 no change to the lat/long values when going to (and through) WGS84.  This 
    159 can be accomplished by asking PROJ to use a <i>null</i> grid shift file  
    160 for switching from your spherical lat/long coordinates to WGS84.<p> 
     100In this case, and many other cases using spherical projections, the desired approach is to actually treat the lat/long locations on the sphere as if they were on WGS84 without any adjustments when using them for converting to other coordinate systems.  The solution is to "trick" PROJ.4 into applying no change to the lat/long values when going to (and through) WGS84.  This can be accomplished by asking PROJ to use a null grid shift file for switching from your spherical lat/long coordinates to WGS84. 
    161101 
    162 <pre> 
     102{{{ 
    163103cs2cs +proj=latlong +datum=WGS84  
    164104    +to +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0  
    165105                   +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs 
    166 </pre> 
     106}}} 
    167107 
    168 Note the strategic addition of <tt>+nadgrids=@null</tt> to the spherical 
    169 projection definition.<p> 
     108Note the strategic addition of +nadgrids=@null to the spherical projection definition. 
    170109 
    171 Similar issues apply with many other datasets distributed with projections 
    172 based on a spherical earth model - such as many NASA datasets, and also 
    173 (I think) the Google Maps mercator projection.<p> 
     110Similar issues apply with many other datasets distributed with projections based on a spherical earth model - such as many NASA datasets, and also (I think) the Google Maps mercator projection. 
    174111 
    175 <!--------------------------------------------------------------------------> 
    176  
    177 <hr> 
    178  
    179 Requests to add items to the frequently asked questions list  
    180 <a href="http://bugzilla.remotesensing.org/enter_bug.cgi?product=PROJ.4"> 
    181 can be entered</a> in bugzilla.<p> 
    182 </body> 
    183 </html>