Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ogrsf_frmts.h>
- bool read_data_from_postgis()
- {
- using std::string;
- GDALAllRegister();
- GDALDataset* poDS;
- string source = "PG:host=192.168.1.11 port=5432 user=postgres password=abcd dbname=postgres";
- poDS = (GDALDataset*)GDALOpenEx(source.c_str(), NULL, NULL, NULL, NULL);
- if (poDS == nullptr)
- {
- std::cerr << "connection FAILED.n";
- return false;
- }
- std::cout << "Connected to Postgres.n";
- std::cout << poDS->GetLayerCount() << std::endl; // return 0!!
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement