2.93 - More tiles

This commit is contained in:
alex
2016-09-30 20:51:24 +01:00
parent b7a8170d4a
commit cc7c64e198
2 changed files with 15 additions and 14 deletions

View File

@@ -214,7 +214,7 @@ void readLIDAR(FILE *fd, int h, int w, int indx,double n, double e, double s, do
int loadLIDAR(char *filenames)
{
char *filename;
char *files[25]; // 25 tiles
char *files[100]; // 10x10 tiles
int x, y, indx = 0, fc = 0, hoffset = 0, voffset = 0, pos,
dem_alloced = 0;
double xll, yll, xur, yur, cellsize, avgCellsize;
@@ -269,18 +269,19 @@ int loadLIDAR(char *filenames)
if (fgets(line, 255, fd) != NULL)
sscanf(pch, "%lf", &cellsize);
avgCellsize=avgCellsize+cellsize;
if(cellsize>=0.5){ // 50cm LIDAR?
/*if(cellsize>=0.5){ // 50cm LIDAR?
// compute xur and yur with inverse haversine if cellsize in *metres*
double roundDistance = (width*cellsize)/6371000;
yur = asin(sin(yll*DEG2RAD) * cos(roundDistance) + cos(yll * DEG2RAD) * sin(roundDistance) * cos(0)) * TO_DEG;
xur = ((xll*DEG2RAD) + atan2(sin(90*DEG2RAD) * sin(roundDistance) * cos(yll*DEG2RAD), cos(roundDistance) - sin(yll * DEG2RAD) * sin(yur*DEG2RAD))) * TO_DEG;
}else{
}else{*/
// Degrees with GDAL option: -co "FORCE_CELLSIZE=YES"
xur = xll+(cellsize*width);
yur = yll+(cellsize*height);
}
//}
if (xur > eastoffset)
eastoffset = xur;
@@ -288,7 +289,7 @@ int loadLIDAR(char *filenames)
westoffset = xll;
if (debug)
fprintf(stdout,"%d, %d, %.7f, %.7f, %.0f, %.7f, %.7f\n",width,height,xll,yll,cellsize,yur,xur);
fprintf(stdout,"%d, %d, %.7f, %.7f, %.7f, %.7f, %.7f\n",width,height,xll,yll,cellsize,yur,xur);
// Greenwich straddling hack
@@ -332,12 +333,12 @@ int loadLIDAR(char *filenames)
// TESTING!
IPPD=width;
ippd=width;
avgCellsize=avgCellsize/fc;
height = (unsigned)((max_north-min_north) / avgCellsize);
width = (unsigned)((max_west-min_west) / avgCellsize);
//avgCellsize=avgCellsize/fc;
height = (unsigned)((max_north-min_north) / cellsize);
width = (unsigned)((max_west-min_west) / cellsize);
if (debug)
fprintf(stdout, "fc %d WIDTH %d HEIGHT %d ippd %d minN %.5f maxN %.5f minW %.5f maxW %.5f\n", fc, width, height, ippd,min_north,max_north,min_west,max_west);
fprintf(stdout, "fc %d WIDTH %d HEIGHT %d ippd %d minN %.5f maxN %.5f minW %.5f maxW %.5f avgCellsize %.5f\n", fc, width, height, ippd,min_north,max_north,min_west,max_west,avgCellsize);
return 0;
}

10
main.cc
View File

@@ -1,4 +1,4 @@
double version = 2.92;
double version = 2.93;
/****************************************************************************\
* Signal Server: Radio propagation simulator by Alex Farrant QCVS, 2E0TDW *
******************************************************************************
@@ -1024,7 +1024,7 @@ int main(int argc, char *argv[])
unsigned char LRmap = 0, txsites = 0, topomap = 0, geo = 0, kml =
0, area_mode = 0, max_txsites, ngs = 0;
char mapfile[255], udt_file[255], ano_filename[255], lidar_tiles[1024], clutter_file[255];
char mapfile[255], udt_file[255], ano_filename[255], lidar_tiles[4096], clutter_file[255];
double altitude = 0.0, altitudeLR = 0.0, tx_range = 0.0,
rx_range = 0.0, deg_range = 0.0, deg_limit = 0.0, deg_range_lon;
@@ -1036,7 +1036,7 @@ int main(int argc, char *argv[])
}
if (strstr(argv[0], "signalserverLIDAR")) {
MAXPAGES = 25; // 5x5
MAXPAGES = 100; // 10x10
lidar = 1;
IPPD = 500; // will be overridden based upon file header...
}
@@ -1227,7 +1227,7 @@ int main(int argc, char *argv[])
z = x + 1;
lidar=1;
if (z <= y && argv[z][0] && argv[z][0] != '-')
strncpy(lidar_tiles, argv[z], 1022);
strncpy(lidar_tiles, argv[z], 4094);
}
if (strcmp(argv[x], "-res") == 0) {
@@ -1611,7 +1611,7 @@ int main(int argc, char *argv[])
err = loadLIDAR(lidar_tiles);
if (err) {
fprintf(stderr, "Couldn't find one or more of the "
fprintf(stdout, "Couldn't find one or more of the "
"lidar files. Please ensure their paths are\n"
"correct and try again.\n");
exit(EXIT_FAILURE);