Search code examples
qtprojectionshapefilegdalogr

Displaying vector files in QT using GDAL/OGR


I am writing an application to load vector maps/shape files using gdal/ogr and display them onto a gui designed using Qt. I am new to dealing with vector files, I am not able to decide how to render them on GUI. Few approaches that come to my mind are: - To convert vector files to raster and display them as raster.. - To draw each shape in vector file one by one (i dont know how to do this, I dont even know whether it would be even possible this using GDAL/OGR, or how complex this would be because in my case vector files can be very complex)

The decision how to render vector files is very important for me, because after displaying vector files i need to support some advanced features like projection change, interactive selection, Geo-referencing etc.

Can any one who has worked on vector/gis stuff, tell me how this is usually done and what Qt widget is used for displaying such data.


Solution

  • I solved the problem of drawing vector files by writing rendering functions for each type of shape files. Qt's QPainter was really handy for drawing shapes like Polygon, Multipolygon, Line, Multiline and then displaying the output as QImage.