Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
osmium/examples/osmium_find_bbox.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
37 lines (25 sloc)
963 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This is a small tool to find the bounding box of the input file. | |
| The code in this example file is released into the Public Domain. | |
| */ | |
| #include <iostream> | |
| #define OSMIUM_WITH_PBF_INPUT | |
| #define OSMIUM_WITH_XML_INPUT | |
| #include <osmium.hpp> | |
| #include <osmium/handler/find_bbox.hpp> | |
| /* ================================================== */ | |
| int main(int argc, char* argv[]) { | |
| if (argc != 2) { | |
| std::cerr << "Usage: " << argv[0] << " OSMFILE" << std::endl; | |
| exit(1); | |
| } | |
| Osmium::OSMFile infile(argv[1]); | |
| Osmium::Handler::FindBbox handler; | |
| Osmium::Input::read(infile, handler); | |
| Osmium::OSM::Bounds bounds = handler.bounds(); | |
| std::cout << "minlon=" << bounds.bottom_left().lon() | |
| << " minlat=" << bounds.bottom_left().lat() | |
| << " maxlon=" << bounds.top_right().lon() | |
| << " maxlat=" << bounds.top_right().lat() << std::endl; | |
| google::protobuf::ShutdownProtobufLibrary(); | |
| } | |