Greenwich LIDAR bugfix

This commit is contained in:
alex
2016-01-15 21:19:53 +00:00
parent f71d4d0d31
commit d5776d3d6e
5 changed files with 57 additions and 23 deletions

View File

@@ -1,4 +1,8 @@
SIGNAL SERVER CHANGELOG
2.7.1 - 14 Jan 2016
LIDAR longitude bugfix for Greenwich meridian tiles
Adjusted ITM parameters warnings
2.7 - 03 Jan 2016
Added support for LIDAR data in ASCII grid format with WGS84 bounds
Increased resolution to +54000 pixels per degree (2m)

View File

@@ -102,6 +102,9 @@ extern double dBm;
extern double loss;
extern double field_strength;
extern __thread double *elev;
extern double westoffset;
extern double eastoffset;
extern double delta;
extern char string[];
extern char sdf_path[];

View File

@@ -18,6 +18,8 @@ int loadLIDAR(char *filename)
yurcorner 51.878474
cellsize 2
NODATA_value -9999
*/
int x, y, width, height, cellsize;
@@ -40,28 +42,32 @@ int loadLIDAR(char *filename)
if (fgets(line, 20, fd) != NULL) {
height=atoi(pch);
}
fgets(line, 21, fd); //
fgets(line, 24, fd); //
if (fgets(line, 22, fd) != NULL) {
xll=atof(pch);
if (fgets(line, 24, fd) != NULL) {
//xll=atof(pch);
sscanf(pch, "%lf", &xll);
}
fgets(line, 21, fd); //
fgets(line, 24, fd); //
if (fgets(line, 22, fd) != NULL) {
yll=atof(pch);
if (fgets(line, 24, fd) != NULL) {
//yll=atof(pch);
sscanf(pch, "%lf", &yll);
}
fgets(line, 21, fd); //
fgets(line, 24, fd); //
if (fgets(line, 22, fd) != NULL) {
xur=atof(pch);
if (fgets(line, 24, fd) != NULL) {
//xur=atof(pch);
sscanf(pch, "%lf", &xur);
}
fgets(line, 21, fd); //
fgets(line, 24, fd); //
if (fgets(line, 22, fd) != NULL) {
yur=atof(pch);
if (fgets(line, 24, fd) != NULL) {
//yur=atof(pch);
sscanf(pch, "%lf", &yur);
}
fgets(line, 21, fd); //
@@ -69,6 +75,17 @@ int loadLIDAR(char *filename)
if (fgets(line, 21, fd) != NULL) {
cellsize=atoi(pch);
}
eastoffset=xur;
westoffset=xll;
// Greenwich straddling hack
if(xll < 0 && xur > 0){
delta = (xur - xll);
xur=0.0;
xll=delta;
delta=eastoffset; // add to Tx longitude later
}else{
// Transform WGS84 longitudes into 'west' values as society finishes east of Greenwich ;)
if(xll > 0){
@@ -83,17 +100,23 @@ int loadLIDAR(char *filename)
if(xur < 0){
xur=xur*-1;
}
}
if(debug){
fprintf(stdout,"yll %.7f yur %.7f xur %.7f xll %.7f delta %.6f\n",yll,yur,xur,xll,delta);
}
dem[0].min_north=yll;
min_north=yll;
dem[0].max_north=yur;
max_north=yur;
dem[0].min_west=xur;
min_west=xur;
dem[0].max_west=xll;
max_west=xll;
if(debug){
fprintf(stdout,"yll %.2f yur %.2f xur %.2f xll %.2f\n",yll,yur,xur,xll);
}
if(width!=height){
fprintf(stdout,"LIDAR tile is not a square. Rows != Columns\n");
return 0;

12
main.cc
View File

@@ -1,4 +1,4 @@
double version = 2.7;
double version = 2.7.1;
/****************************************************************************\
* Signal Server: Server optimised SPLAT! by Alex Farrant, M6ZUJ *
******************************************************************************
@@ -44,7 +44,7 @@ char string[255], sdf_path[255], udt_file[255], opened = 0, gpsav =
double earthradius, max_range = 0.0, forced_erp, dpp, ppd, yppd,
fzone_clearance = 0.6, forced_freq, clutter, lat, lon, txh, tercon, terdic,
north, east, south, west, dBm, loss, field_strength,
min_north = 90, max_north = -90, min_west = 360, max_west = -1;
min_north = 90, max_north = -90, min_west = 360, max_west = -1, westoffset=0, eastoffset=0, delta=0;
int ippd, mpi,
max_elevation = -32768, min_elevation = 32768, bzerror, contour_threshold,
@@ -1538,6 +1538,7 @@ int main(int argc, char *argv[])
min_lat = 70;
max_lat = -70;
min_lon = (int)floor(tx_site[0].lon);
max_lon = (int)floor(tx_site[0].lon);
@@ -1580,6 +1581,9 @@ int main(int argc, char *argv[])
yppd=rint(ippd / (max_west-min_west));
height=ippd;
width=ippd;
if(delta>0){
tx_site[0].lon+=delta;
}
}else{
LoadTopoData(max_lon, min_lon, max_lat, min_lat);
if (area_mode || topomap) {
@@ -1717,9 +1721,9 @@ int main(int argc, char *argv[])
// Print WGS84 bounds
fprintf(stdout, "|%.6f", north);
fprintf(stdout, "|%.6f", east);
fprintf(stdout, "|%.6f", eastoffset);
fprintf(stdout, "|%.6f", south);
fprintf(stdout, "|%.6f|", west);
fprintf(stdout, "|%.6f|", westoffset);
} else {
strncpy(tx_site[0].name, "Tx", 3);

View File

@@ -1564,16 +1564,16 @@ void PathReport(struct site source, struct site destination, char *name,
case 3:
fprintf(fd2,
"\n Warning: A combination of parameters is out of range.\n");
"\n Warning: A combination of parameters is out of range for this model.\n");
fprintf(fd2,
" Results are probably invalid.\n");
" Results should be used with caution.\n");
break;
default:
fprintf(fd2,
"\n Warning: Some parameters are out of range.\n");
"\n Warning: Some parameters are out of range for this model.\n");
fprintf(fd2,
" Results are probably invalid.\n");
" Results should be used with caution.\n");
}
}