Changes between Initial Version and Version 1 of PostGIS_raster_driver

Apr 30, 2014, 3:22:41 AM (6 years ago)

Create page from Melange Proposal


  • PostGIS_raster_driver

    v1 v1  
     2== Write support for the PostGIS Raster driver ==
     6A GDAL driver allows reading/writing of raster(or images) data from/to formats like TIFF, PNG or JPEG. The current GDAL PostGIS Raster driver supports reading of PostGIS rasters objects from a PostgreSQL/PostGIS database but does not support writing. This project includes designing and implementing a driver for write support. Currently PostGIS raster2pgsql loader is used to load GDAL supported raster formats in the database.
     10PostGIS Raster is the project that provides raster support on PostGIS. Most GDAL drivers are based in the concept of block. In tiled datasets, 1 block = 1 tile and all tiles have the same dimensions (width and height). But in the GDAL PostGIS Raster, each tile of a coverage can have different dimensions, different pixel size etc. In order to handle such kinds of tiles, the GDAL PostGIS Raster uses the VRT driver as proxy since it works in the same manner. Important methods used for writing in database are IWriteBlock and IRasterIO. The PostGIS Raster driver works with IRasterIO since the driver needs to handle unequally sized blocks.
     12'''The idea'''
     14* Modify the I/O of the driver to respond to the input arguments: The PostGIS raster2pgsql loader takes multiple arguments depending on the users requirements. Similarly the GDAL PostGIS Raster driver needs to respond appropriately to the input arguments. In case some specific options need to be passed, layer creation options and configuration options are to be used from ogr2ogr.
     16* Implement methods for writing the sql query in buffer: The key functions from the PostGIS raster2pgsql loader that need to be implemented/duplicated are:
     18a) process_rasters
     19b) convert_raster
     20c) create_table
     21d) drop_table
     22e) insert_record
     23f) create_index
     24g) analyze_table
     25h) append_sql_to_buffer
     27More functions will be needed to implement later but these are the key ones I figured out for now.
     29* Implement methods to write the query in the database: The input data is read into the memory buffer, which is then passed as an argument to PostGISRasterRasterBand::IRasterIO method. Using the above implemented functions transform the buffer data into SQL code. Modify this IRasterIO method which executes the SQL code to write the data into a region of PostGISRasterRasterBand(in the PostgreSQL db). IRasterIO method is used to handle such unequally sized blocks of data with different dimensions, geo-referencing, pixel size etc.
     31* Testing: The driver needs to be robust and respond to all the arguments passed to it appropriately. I would test all the possible use cases of the driver on similar lines with the raster2pgsql loader. The testing would be done using the GDAL autotest suite. All tests are to be automated and added to the suite.
     33'''Project plan'''
     35I will have about 12 weeks to complete the project. Here is a tentative schedule:
     37* Before 19th May: Refine project plan. Get familiar with the development environment of GDAL and PostGIS.
     38* Week 1-2: Understanding and familiarizing with the I/O system in GDAL.
     39* Week 3-5: Compose the sql query in the buffer. Write methods to prepare the sql query.
     40* Week 6: Mid-term evaluations. Solve bugs that may come up during the evaluation.
     41* Week 7: Implement methods to load the raster files in the buffer
     42* Week 8-9: Modify the IRasterIO and more methods to write data from the buffer to the PostgreSQL database.
     43* Week 10: Buffer time. Clean up the code wherever required.
     44* Week 11-12: Testing and bug fixing. Draft final report and documentation.
     46'''Future ideas / How can your idea be expanded?'''
     48The QGIS DBManager plugin will be required to be tested with the new driver with write support. After the completion of this project we will have GDAL + PostGIS Raster with read as well as write support. This will be a powerful tool for third parties that rely on PostGIS for their data and use GDAL as main tool to handle it. They will be able to just use GDAL to read/write data in PostGIS Raster, without using the loader. I have also contacted with the PostGIS users/dev lists, to ask them for future uses and possible features that might be needed.
     50'''Project Progress'''
     56GDAL Commits: