OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.78k stars 2.5k forks source link

[Feature Request] Implement OGR Driver for Dameng Database #10516

Open Ha1fm0oN opened 1 month ago

Ha1fm0oN commented 1 month ago

Feature description

As a spatial data developer working with DM Database. I need an OGR to implement spatial data conversion with other data sources.

Currently, I have successfully implemented the ogr2ogr conversion functionality, but I am facing challenges in implementing other essential parts of the driver.

I have tested the ogr2ogr conversion with a few test cases and it seems to be working fine. However, I need guidance on how to proceed with full driver support, including read/write operations, error handling, and potential optimizations.

Questions:

What are the key steps I should follow to expand my current ogr2ogr implementation into a full driver? Are there any existing drivers that I can use as a reference or starting point? What are the best practices for testing an OGR driver, especially using pytest?

Additional context

My Branch:https://github.com/Ha1fm0oN/DMForOgr

rouault commented 1 month ago

A few hints:

Ha1fm0oN commented 1 week ago

Thank you very much for your hints. I was working on this project in my spare time, so the progress has been very slow. Recently, I have modified some of the ogr_DM driver code and completed the compilation of ogr2ogr. I have tested the related functions of ogr2ogr and have encountered some problems:

I completed the build using cmake on a Windows system. During the build process, I found that if I specified DM_INCLUDE_DIR and DM_LIBRARY_RELEASE, the build could be completed normally. However, if I did not set these two options, the build would encounter an error. These two options seem to have become mandatory, and I think it may have been caused by an error in my writing of FindDM.cmake. However, I am not sure where the error lies. I wrote it based on FindPostgreSQL.cmake and made some modifications.

For testing, I used Visual Studio to debug the test_ogrsf project locally, and encountered issues during debugging. It always had problems with INFO: DM: TestCreate skipped. It seems that there was an issue with GetMetadataItem (GDAL_DCAP_VIRTUALIO) and GetMetadataItem (GDAL_DCAP_CREATE), and I am not sure how to modify it. I added the relevant SetMetadataItem in RegisterOGRDM() and set it to YES, but it seems not work.


I have already resolved the first issue, where I mistakenly used ogr_optinald_river in the \ogr\ogrsf_frmts\CMakeLists.txt. The problem was resolved when I switched to ogr_dependent_driver. But I have a question about it. I am using ogr_dependent_driver (dm "DMGEO2" "). Will this have any impact?