[gdal-dev] VRT performance Improvement

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Tue Jul 28 10:30:10 PDT 2020


Hi,

I guess that the slowest part is not VRT but your SQL
SELECT * FROM "features" WHERE LegendEntryName 
    IN("V_XX_AR","V_XX_LB","V_DOCIND_PT","V_XX_ML") because GeoJSON does not
support attribute indexes. I would have a try by converting GeoJSON into
GeoPackage or any other database format. Remember to create the index as
well

ogrinfo -sql "create index legendentryname_idx on my_table(legententryname)"
my_geopackage.gpkg

Running attribute queries without index is so expensive that it is waste of
time to begin to optimize anything else. I do not know if GDAL has methods
for creating temporary attribute indexes so that you would not need to
convert GeoJSON physically into some other format.

-Jukka Rahkonen-


MRRAJESH wrote
> Developers,
> 
> We are using VRT file (located in physical disk) as input to
> GDALVectorTranslate in C++. This VRT file pointing JSON file, which is
> little bigger size. How to improve the performance?
> 
>          const char *pszFilename = "C:\\Test\\MVT.vrt";	
>          hSrcDS = (GDALDatasetH *)GDALOpenEx(pszFilename,
> GDAL_OF_READONLY, NULL,NULL, NULL);
> 
>          dst = (GDALDataset *)GDALVectorTranslate(vsibuf, NULL, 1,
> &hSrcDS, opt,NULL);
> 
> *VRT FILE:*
> 
> OGRVRTDataSource>
>   
> <OGRVRTLayer name="Administrative">
>     
> <SrcDataSource relativeToVRT="1">
> features.json
> </SrcDataSource>
>     
> <SrcSQL dialect="sqlite">
> SELECT * FROM "features" WHERE LegendEntryName 
>     IN("V_XX_AR","V_XX_LB","V_DOCIND_PT","V_XX_ML")
> </SrcSQL>
>    
> </OGRVRTLayer>
> .....
> ....
> 
> 
> Regards,
> Rajesh
> 
> 
> 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list