Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 36341

An object-oriented programming language

1 vote

How to apply a color to a geotiff image based on the elevation data?

This C++ repository (https://github.com/khafen74/raster2png) was developed to convert GeoTiffs to colored PNG images using GDAL. You can create a GDAL color table like so: colorTable = new GDALColo …
khafen's user avatar
  • 480
1 vote

Reading 1/3 arcsecond DEM data using C++?

This is very doable using C++. Some example code is below. You just need to use the correct driver. See here for driver formats. "HFA" is the code for the Erdas imagine (.img) format. GDALDataset *pD …
khafen's user avatar
  • 480
3 votes
Accepted

Error getting ESRI Shapefile driver OGR in C++

This code works for creating an OGRDataSource. Special thanks to Michael Miles-Stimson for getting me on the right track. const char* path = "C:/Test/test.shp"; OGRRegisterAll(); OGRDataSource *hDS; …
khafen's user avatar
  • 480
1 vote

GDAL Application crashes when loading GDAL drivers?

I experienced a similar problem. I use Windows 7. I compiled the binaries for MinGW using the steps found on this page http://trac.osgeo.org/gdal/wiki/BuildingWithMinGW (I could not find prebuilt bina …
khafen's user avatar
  • 480
3 votes

How to crop Geotiff image in C++ (GDAL or other possibilities)?

You could do this easily enough in C++. The way I would do it is to send the path of the file you want to crop, the path of the output/cropped raster, the top left coordinates of the cropped raster an …
khafen's user avatar
  • 480
1 vote

Convertion of a .dem file to coordinates and elevation

This is easy to do using GDAL. Here is function I regularly use to convert raster data to XYZ format. Note: .xyz is just a space (or tab) delimited text file. #include "gdal_priv.h" void Raster::toX …
khafen's user avatar
  • 480
2 votes
Accepted

Adding band to GDAL VRT dataset and converting to TIFF using GDAL?

There were two problems. One noticed by @kyle, that the VRTDataset depends on the original, the other that the datasets needed to be closed in a specific order. Since all the datasets in this example …
khafen's user avatar
  • 480