Geographic Information Systems Asked by Sogun on September 9, 2020
I’m trying to write a .gdb file (could also be any other format, geojson, gpkg, etc.) to a Spatialite DB but it takes awhile and I am getting a warning.
Command:
ogr2ogr --config OGR_SQLITE_CACHE 1024 -f SQLite -dsco SPATIALITE=YES -nlt MULTIPOLYGON slite.db tmp_dls/data_d4e815db1/Universe.gdb -nln paqrcel_lines lotlines -gt unlimited
Warning message:
Warning 1: organizePolygons() received a polygon with more than 100 parts. The processing may be really slow. You can skip the processing by setting METHOD=SKIP, or only make it analyze counter-clock wise parts by setting METHOD=ONLY_CCW if you can assume that the outline of holes is counter-clock wise defined
I know SQLite has low default settings for transactions and memory which is why I added the -gt unlimited
and --config OGR_SQLITE_CACHE 1024
options but they dont have any affect on the speed of the command. With those 2 options removed it takes the same amount of time.
Is there a command in ogr2ogr I can use to make this run faster, or maybe I should switch to geopandas and use some shapely function to solve this?
Thanks any help is appreciated!
The error means that your source data contains a polygon with more than 100 parts. I believe that in this context parts mean rings, both outer and inner ones. Rather good explanation can be found from https://gdal.org/doxygen/classOGRGeometryFactory.html#a9ce97d39ca2e0dd88f415227e71b7fd5
Organize polygons based on geometries. Analyse a set of rings (passed as simple polygons), and based on a geometric analysis convert them into a polygon with inner rings, (or a MultiPolygon if dealing with more than one polygon) that follow the OGC Simple Feature specification. All the input geometries must be OGRPolygon/OGRCurvePolygon with only a valid exterior ring (at least 4 points) and no interior rings. The passed in geometries become the responsibility of the method, but the papoPolygons "pointer array" remains owned by the caller. For faster computation, a polygon is considered to be inside another one if a single point of its external ring is included into the other one. (unless 'OGR_DEBUG_ORGANIZE_POLYGONS' configuration option is set to TRUE. In that case, a slower algorithm that tests exact topological relationships is used if GEOS is available.) In cases where a big number of polygons is passed to this function, the default processing may be really slow. You can skip the processing by adding METHOD=SKIP to the option list (the result of the function will be a multi-polygon with all polygons as toplevel polygons) or only make it analyze counterclockwise polygons by adding METHOD=ONLY_CCW to the option list if you can assume that the outline of holes is counterclockwise defined (this is the convention for example in shapefiles, Personal Geodatabases or File Geodatabases). For FileGDB, in most cases, but not always, a faster method than ONLY_CCW can be used. It is CCW_INNER_JUST_AFTER_CW_OUTER. When using it, inner rings are assumed to be counterclockwise oriented, and following immediately the outer ring (clockwise oriented) that they belong to. If that assumption is not met, an inner ring could be attached to the wrong outer ring, so this method must be used with care. If the OGR_ORGANIZE_POLYGONS configuration option is defined, its value will override the value of the METHOD option of papszOptions (useful to modify the behavior of the shapefile driver)
I am not sure if I understood right how to control which method is used for analysing the rings but I would try with this command:
ogr2ogr --config OGR_SQLITE_CACHE 1024 -f SQLite -dsco SPATIALITE=YES -nlt MULTIPOLYGON slite.db tmp_dls/data_d4e815db1/Universe.gdb -nln paqrcel_lines lotlines -gt unlimited --config OGR_ORGANIZE_POLYGONS CCW_INNER_JUST_AFTER_CW_OUTER
Write a mail to gdal-dev list if this command does not make any difference or throws some error.
Answered by user30184 on September 9, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP