Skip to content

Commit

Permalink
issue #40: Fix bug with creating merged_sites layer where Alaska basi…
Browse files Browse the repository at this point in the history
…ns were using wrong DEM; Found another manifestation of the 3.x image service clip error and added extent; Need to verify correct extent
  • Loading branch information
lbross committed Apr 21, 2023
1 parent 3c1b1af commit e404557
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
6 changes: 4 additions & 2 deletions bagis-pro/AnalysisTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4766,7 +4766,8 @@ await QueuedTask.Run(() => {

// Assign the site id by elevation
success = await UpdateSiteIdsAsync(analysisPath, gdbUri, arrHasSites, arrSiteFiles);
var environments = Geoprocessing.MakeEnvironmentArray(workspace: strAoiPath, snapRaster: BA_Objects.Aoi.SnapRasterPath(strAoiPath));
var environments = Geoprocessing.MakeEnvironmentArray(workspace: strAoiPath, snapRaster: BA_Objects.Aoi.SnapRasterPath(strAoiPath),
extent: BA_Objects.Aoi.SnapRasterPath(strAoiPath));
string fileExtract = "tmpExtract";
string[] arrFields = { Constants.FIELD_PRECIP, Constants.FIELD_ASPECT, Constants.FIELD_SLOPE};
string[] arrFieldDataTypes = { "DOUBLE", "DOUBLE", "DOUBLE" };
Expand Down Expand Up @@ -4814,7 +4815,8 @@ await QueuedTask.Run(() => {
if (arrIsImageService[i] == true || await GeodatabaseTools.RasterDatasetExistsAsync(new Uri(arrUri[i]), arrInputRasters[i]))
{
var parameters = Geoprocessing.MakeValueArray(returnPath, inputRaster, analysisPath + "\\" + fileExtract, "NONE", "VALUE_ONLY");
var gpResult = await Geoprocessing.ExecuteToolAsync("ExtractValuesToPoints_sa", parameters, environments,

var gpResult = await Geoprocessing.ExecuteToolAsync("ExtractValuesToPoints_sa", parameters, environments,
CancelableProgressor.None, GPExecuteToolFlags.AddToHistory);
if (gpResult.IsFailed)
{
Expand Down
1 change: 0 additions & 1 deletion bagis-pro/DockBatchToolsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,6 @@ private async void RunForecastImplAsync(object param)
string strTriplet = "";
string strStationName = "";
string strAwdbId = "";
string strHuc2 = "";
string strNearTriplet = "";
string strNearStationName = "";
string strNearAwdbId = "";
Expand Down
1 change: 0 additions & 1 deletion bagis-pro/Module1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ protected override bool Initialize()
internal dynamic BatchToolSettings { get; set; } = "";
internal double PrismZonesInterval { get; set; } = 999;
internal string WesternStateBoundariesUri { get; } = "";
internal string Dem30Uri { get; } = "";
internal string RoadsBufferDistance { get; set; } = "";
internal string DataSourceGroup { get; set; } = Constants.DATA_SOURCES_DEFAULT;
internal string ChromePath { get; set; } = "";
Expand Down
36 changes: 23 additions & 13 deletions bagis-pro/Webservices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,26 +331,36 @@ public async Task<string> GetWesternStateBoundariesUriAsync()

public async Task<string> GetDem30UriAsync()
{
if (!string.IsNullOrEmpty(Module1.Current.Dem30Uri))
IDictionary<string, BA_Objects.DataSource> dictLocalDataSources = GeneralTools.QueryLocalDataSources();
if (!dictLocalDataSources.ContainsKey(BA_Objects.DataSource.GetDemKey))
{
return Module1.Current.Dem30Uri;
}
else
{
var response = new EsriHttpClient().Get(Constants.URI_DESKTOP_SETTINGS);
var json = await response.Content.ReadAsStringAsync();
dynamic oSettings = JObject.Parse(json);
if (oSettings == null || String.IsNullOrEmpty(Convert.ToString(oSettings.dem30)))
IDictionary<string, dynamic> dictDatasources = await this.QueryDataSourcesAsync((string)Module1.Current.BatchToolSettings.EBagisServer);
if (dictDatasources != null)
{
Module1.Current.ModuleLogManager.LogError(nameof(GetDem30UriAsync),
"Unable to retrieve settings from " + Constants.URI_DESKTOP_SETTINGS);
return "";
BA_Objects.DataSource dsDem = new BA_Objects.DataSource(dictDatasources[BA_Objects.DataSource.GetDemKey]);
if (dsDem != null)
{
return dsDem.uri;
}
else
{
Module1.Current.ModuleLogManager.LogError(nameof(GetDem30UriAsync),
$@"Unable to find element 30m DEM in server data sources");
return "";
}
}
else
{
return Convert.ToString(oSettings.dem30);
Module1.Current.ModuleLogManager.LogError(nameof(GetDem30UriAsync),
$@"Unable to retrieve data sources from server!");
return "";
}
}
else
{
BA_Objects.DataSource dsDem = new BA_Objects.DataSource(dictLocalDataSources[BA_Objects.DataSource.GetDemKey]);
return dsDem.uri;
}
}

public async Task<BA_ReturnCode> UpdateAoiItemsAsync(string stationTriplet)
Expand Down

0 comments on commit e404557

Please sign in to comment.