easymapnik: SRTM only if command line option given

This commit is contained in:
Nick Whitelegg 2009-02-16 23:54:07 +00:00
parent c6c1cc32d7
commit 95c6e8e9ec
3 changed files with 32 additions and 24 deletions

View file

@ -77,6 +77,11 @@ void MapSource::process_cmd_line_args(int argc,char *argv[])
argv+=2;
argc-=2;
break;
case 'r': srtm=true;
argv++;
argc--;
break;
}
}
else
@ -150,7 +155,8 @@ void MapSource::generateMaps()
p["type"] ="osm";
load_map(m,xmlfile);
setOSMLayers(m,p);
addSRTMLayers(m,curlon,curlat,nextlon,nextlat);
if(srtm)
addSRTMLayers(m,curlon,curlat,nextlon,nextlat);
// lonToX() and latToY() give *pixel* coordinates
GoogleProjection proj;

View file

@ -35,6 +35,7 @@ private:
double w,s,e,n;
bool useBbox, tiled, multirqst;
int zoom_start,zoom_end;
bool srtm;
static void setOSMLayers(Map& m, const parameters &p);
static void addSRTMLayers(Map& m,double w,double s,double e,double n);
@ -56,6 +57,7 @@ public:
multirqst=false;
//url="http://xapi.openstreetmap.org/api/0.5/map";
url="http://osmxapi.hypercube.telascience.org/api/0.5/map";
srtm=false;
}

View file

@ -16,19 +16,19 @@ int main(int argc,char *argv[])
{
if(argc<2 || (argc>=2 && !strcmp(argv[1],"-h")))
{
usage();
help();
usage();
help();
exit(0);
}
MapSource s ;
s.process_cmd_line_args(argc,argv);
s.process_cmd_line_args(argc,argv);
if(!s.isValid())
{
cerr << "Invalid combination of command-line parameters!" << endl<<endl;
usage();
usage();
exit(1);
}
@ -37,7 +37,7 @@ int main(int argc,char *argv[])
freetype_engine::register_font
("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf");
s.generateMaps();
s.generateMaps();
return 0;
@ -47,27 +47,27 @@ int main(int argc,char *argv[])
void usage()
{
cerr << "Usage: render_new -s source [-w width] [-h height] -x xmlfile "
<< endl <<
"[-i InOSMFile] [-o OutPNGFile] [-t] [-z startzoom] [-Z endzoom] "
<< endl <<
"[-b bbox] [-u serverURL] [-m]" << endl << endl;
cerr << "Usage: easymapnik -s source [-w width] [-h height] -x xmlfile "
<< endl <<
"[-i InOSMFile] [-o OutPNGFile] [-t] [-z startzoom] [-Z endzoom] "
<< endl <<
"[-b bbox] [-u serverURL] [-m]" << endl << endl;
}
void help()
{
cerr << "Source should be 'osm' or 'api', indicating OSM files and "
<< endl << "retrieval direct from a server (e.g. OSMXAPI) respectively."
<< endl <<
"-t indicates tiled mode (generate 'Google' style tiles); you must "
<< endl <<
"supply at least a start zoom, and a bounding box, for this."
<< endl <<
"-m means 'multirequest'; if you're requesting a relatively large "
<< endl <<
"area from the server (e.g. OSMXAPI), it will fetch it in "
<< "0.1x0.1 degree tiles. "
<< endl << "This speeds up processing considerably." << endl;
exit(1);
cerr << "Source should be 'osm' or 'api', indicating OSM files and "
<< endl << "retrieval direct from a server (e.g. OSMXAPI) respectively."
<< endl <<
"-t indicates tiled mode (generate 'Google' style tiles); you must "
<< endl <<
"supply at least a start zoom, and a bounding box, for this."
<< endl <<
"-m means 'multirequest'; if you're requesting a relatively large "
<< endl <<
"area from the server (e.g. OSMXAPI), it will fetch it in "
<< "0.1x0.1 degree tiles. "
<< endl << "This speeds up processing considerably." << endl;
exit(1);
}