diff --git a/.github/workflows/update_mac_tests.sh b/.github/workflows/update_mac_tests.sh index 1d96ec870..e046568a9 100755 --- a/.github/workflows/update_mac_tests.sh +++ b/.github/workflows/update_mac_tests.sh @@ -52,6 +52,7 @@ echo "Pushing the updated tarball to the cloud" repo=git@github.com:NeoGeographyToolkit/StereoPipelineTest.git gh=/home/oalexan1/miniconda3/envs/gh/bin/gh tag=0.0.1 +echo Wipe the old tests and upload the new ones $gh release -R $repo delete $tag # wipe old tarball notes="Update test results" $gh release -R $repo create $tag $binaries --title $tag --notes "$notes" # upload new diff --git a/docs/tools/point2dem.rst b/docs/tools/point2dem.rst index ae4eff5e1..dae67f98b 100644 --- a/docs/tools/point2dem.rst +++ b/docs/tools/point2dem.rst @@ -35,9 +35,12 @@ Use the option ``--t_srs`` to set a desired output projection. The projection should be local to the current area of interest. If this is not set, the ``point2dem`` program inherits the projection from the -input images, if those are mapprojected (:numref:`mapproj-example`). If the -input is a LAS file having a projection, that will be used. If the input is a -CSV file, the projection from ``--csv-srs`` will be used. +input images, if those are mapprojected (:numref:`mapproj-example`) and the +projection is not geographic. + +If the input is a LAS file having a projection that is not geographic, that will +be used. If the input is a CSV file, the projection from ``--csv-srs`` will be +used. If none of these are applicable, in the latest ASP (:numref:`release`), ``point2dem`` automatically finds a good local projection in meters. For ASP diff --git a/src/asp/Core/PointToDem.cc b/src/asp/Core/PointToDem.cc index 96ab5e395..af0fb6367 100644 --- a/src/asp/Core/PointToDem.cc +++ b/src/asp/Core/PointToDem.cc @@ -241,12 +241,12 @@ void chip_convert_to_tif(DemOptions const& opt, } // End function chip_convert_to_tif -// Auto-computed local projection +// Auto-compute a local projection. It is assumed that the datum is known. void setAutoProj(double lat, double lon, vw::cartography::GeoReference & output_georef) { - std::string datum = output_georef.datum().name(); - if (datum.find("WGS_1984") != std::string::npos) { + vw::cartography::Datum datum = output_georef.datum(); + if (datum.name().find("WGS_1984") != std::string::npos) { vw::cartography::Datum user_datum = output_georef.datum(); if (lat > 84) @@ -275,6 +275,8 @@ void setProjection(DemOptions const& opt, cartography::GeoReference & output_geo // Shorten notation double lon = opt.proj_lon, lat = opt.proj_lat, s = opt.proj_scale; double e = opt.false_easting, n = opt.false_northing; + + vw::cartography::Datum datum = output_georef.datum(); switch (opt.projection) { case SINUSOIDAL: @@ -315,6 +317,14 @@ void setProjection(DemOptions const& opt, cartography::GeoReference & output_geo vw::vw_throw(ArgumentErr() << "No projection was set.\n"); } + // Must re-apply the datum name, otherwise it gets lost. + // TODO(oalexan1): This fix should go deeper. Likely all the way to + // set_wkt(). But this will need very careful testing as that may + // have unintended consequences. + std::string lc_datum_name = boost::to_lower_copy(output_georef.datum().name()); + if (lc_datum_name.find("unknown") != std::string::npos) + output_georef.set_datum(datum); + return; } diff --git a/src/asp/Tools/point2dem.cc b/src/asp/Tools/point2dem.cc index 465e05277..ec0c7fccc 100644 --- a/src/asp/Tools/point2dem.cc +++ b/src/asp/Tools/point2dem.cc @@ -570,8 +570,9 @@ int main(int argc, char *argv[]) { } // Finalize setting the projection. This is is normally auto-determined. - if ((opt.target_srs_string.empty() || opt.target_srs_string == "auto") - && !opt.input_is_projected) { + if ((opt.target_srs_string.empty() || opt.target_srs_string == "auto") && + (!have_input_georef || !output_georef.is_projected()) && + !opt.input_is_projected) { // Find the median lon lat and reapply this to the georef. Must be done // after estimating the lonlat box. if (std::isnan(opt.proj_lon) && std::isnan(opt.proj_lat))