diff options
| -rwxr-xr-x | webmap-import | 13 | 
1 files changed, 9 insertions, 4 deletions
diff --git a/webmap-import b/webmap-import index 5cfe003..1cf9def 100755 --- a/webmap-import +++ b/webmap-import @@ -929,15 +929,20 @@ def importSource2(lyr_dst, path, args={}, basedir=None, extent=None):              fld.SetIgnored(True)      defn = None +    count0 = -1 +    if lyr.TestCapability(ogr.OLCFastFeatureCount): +        count0 = lyr.GetFeatureCount(force=0) + +    if count0 == 0 and len(fieldSet) == 0: +        # skip the below warning in some cases (e.g., GeoJSON source) +        logging.info('Source layer "%s" has no fields nor features, skipping', layername) +        return +      logging.debug('Field map: %s', str(fieldMap))      for fld in fields:          if not fld in fieldSet:              logging.warning('Source layer "%s" has no field named "%s", ignoring', layername, fld) -    count0 = -1 -    if lyr.TestCapability(ogr.OLCFastFeatureCount): -        count0 = lyr.GetFeatureCount(force=0) -      count1 = -1      if args.get('spatial-filter', True) and extent is not None:          if extent.GetSpatialReference().IsSame(srs):  | 
