2009-02-17 00:42:31 +01:00
|
|
|
#include "MapSource.h"
|
|
|
|
|
|
|
|
void usage();
|
|
|
|
void help();
|
|
|
|
|
|
|
|
|
|
|
|
//////////// modes ////////////////////////////////
|
|
|
|
//
|
|
|
|
// render an OSM file:
|
|
|
|
// Input: XMLfile OSMfile width height [bbox]
|
|
|
|
//
|
|
|
|
// render live data in 256x256 tiles:
|
|
|
|
// Input: XMLfile bbox
|
|
|
|
|
|
|
|
int main(int argc,char *argv[])
|
|
|
|
{
|
|
|
|
if(argc<2 || (argc>=2 && !strcmp(argv[1],"-h")))
|
|
|
|
{
|
2009-02-17 00:54:07 +01:00
|
|
|
usage();
|
|
|
|
help();
|
2009-02-17 00:42:31 +01:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-14 04:37:50 +01:00
|
|
|
MapSource s ;
|
2009-02-17 00:54:07 +01:00
|
|
|
s.process_cmd_line_args(argc,argv);
|
2009-02-17 00:42:31 +01:00
|
|
|
|
|
|
|
if(!s.isValid())
|
|
|
|
{
|
|
|
|
cerr << "Invalid combination of command-line parameters!" << endl<<endl;
|
2009-02-17 00:54:07 +01:00
|
|
|
usage();
|
2009-02-17 00:42:31 +01:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2012-09-07 17:23:03 +02:00
|
|
|
datasource_cache::instance().register_datasources
|
2009-02-17 00:42:31 +01:00
|
|
|
("/usr/local/lib/mapnik/input");
|
|
|
|
freetype_engine::register_font
|
|
|
|
("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf");
|
|
|
|
|
2009-02-17 00:54:07 +01:00
|
|
|
s.generateMaps();
|
2009-02-17 00:42:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void usage()
|
|
|
|
{
|
2009-02-17 00:54:07 +01:00
|
|
|
cerr << "Usage: easymapnik -s source [-w width] [-h height] -x xmlfile "
|
|
|
|
<< endl <<
|
2011-11-14 04:37:50 +01:00
|
|
|
"[-i InOSMFile] [-o OutPNGFile] [-t] [-z startzoom] [-Z endzoom] "
|
2009-02-17 00:54:07 +01:00
|
|
|
<< endl <<
|
2011-11-14 04:37:50 +01:00
|
|
|
"[-b bbox] [-u serverURL] [-m]" << endl << endl;
|
2009-02-17 00:42:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void help()
|
|
|
|
{
|
2011-11-14 04:37:50 +01:00
|
|
|
cerr << "Source should be 'osm' or 'api', indicating OSM files and "
|
|
|
|
<< endl << "retrieval direct from a server (e.g. OSMXAPI) respectively."
|
|
|
|
<< endl <<
|
2009-02-17 00:54:07 +01:00
|
|
|
"-t indicates tiled mode (generate 'Google' style tiles); you must "
|
2011-11-14 04:37:50 +01:00
|
|
|
<< 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;
|
2009-02-17 00:54:07 +01:00
|
|
|
exit(1);
|
2009-02-17 00:42:31 +01:00
|
|
|
}
|