<s> from osgeo import ogr <EOL> ds = ogr . Open ( r'<STR_LIT>' ) <EOL> lyr = ds . GetLayerByName ( '<STR_LIT>' ) <EOL> lyr . SetAttributeFilter ( "<STR_LIT>" ) <EOL> row = next ( lyr ) <EOL> all_areas = row . geometry ( ) . Clone ( ) <EOL> common_areas = row . geometry ( ) . Clone ( ) <EOL> for row in lyr : <EOL> all_areas = all_areas . Union ( row . geometry ( ) ) <EOL> common_areas = common_areas . Intersection ( row . geometry ( ) ) <EOL> percent = common_areas . GetArea ( ) / all_areas . GetArea ( ) * <NUM_LIT:100> <EOL> print ( '<STR_LIT>' . format ( percent ) ) </s>
