Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native FlatGeoBuf from MapServer is not working for files with non specific geometry type #6879

Open
bad-ch opened this issue May 24, 2023 · 4 comments

Comments

@bad-ch
Copy link

bad-ch commented May 24, 2023

We are using the Windows sysinternals gdal/ogr/MapServer bindings x64 for c#, version 8.0 (MSVC 2022), the flatgeobuf is as native input format for MapServer available.

The OGR FlatGeoBuf seems to work:

LAYER NAME "sections" TYPE POLYGON STATUS ON CONNECTIONTYPE OGR CONNECTION "<absolute path>/bb.fgb" CONNECTIONOPTIONS "VERIFY_BUFFERS" "NO" END PROJECTION "init=epsg:2056" END CLASS NAME "Section style" STYLE COLOR 255 128 128 OUTLINECOLOR 96 96 96 END END END

If we use the same datasource with the native FlatGeoBuf connector for MapServer we get back no response => process is crashing

LAYER NAME "sections" TYPE POLYGON STATUS ON CONNECTIONTYPE flatgeobuf DATA "<absolute path>/bb.fgb" EXTENT 2582739 1108919 2828726 1317743 PROCESSING "CLOSE_CONNECTION=DEFER" CLASS NAME "Section style" STYLE COLOR 255 128 128 OUTLINECOLOR 96 96 96 END END END

Any ideas ? I see no fix in the MapServer 8.0.1 release info

@CaptainInler
Copy link

I was able to reproduce it with this geojson:

{
"type": "FeatureCollection",
"name": "Street-FGBOGR",
"features": [
{ "type": "Feature", "properties": { "id": 2, "name": "A" }, "geometry": { "type": "MultiLineString", "coordinates": [ [ [ 8.5446578, 47.3732922 ], [ 8.5449215, 47.3730187 ] ] ] } },
{ "type": "Feature", "properties": { "id": 1, "name": "B" }, "geometry": { "type": "LineString", "coordinates": [ [ 8.5450106, 47.3729256 ], [ 8.5445739, 47.3728152 ] ] } }
]
}

Converted to flatgeobuf with ogr2ogr.exe -f Flatgeobuf C:\test.fgb C:\test.geojson

An this mapfile:

MAP
  NAME "WFS"
  STATUS ON
  SIZE 1400 1300
  SYMBOLSET "#dataPath#/share/symbols.sym"
  EXTENT 6.859 46.121 9.731 47.931
  UNITS METERS
  SHAPEPATH "#projectPath#"
  IMAGECOLOR 255 255 255
  FONTSET "#dataPath#/share/font.list"
  CONFIG "PROJ_LIB" "#dataPath#/share/proj"
  CONFIG "MS_ERRORFILE" "#projectPath#/ms_error.log"
  DEBUG 5

  OUTPUTFORMAT
      NAME "geojson"
      DRIVER "OGR/GEOJSON"
      MIMETYPE "application/json; subtype=geojson"
      FORMATOPTION "STORAGE=stream"
      FORMATOPTION "FORM=SIMPLE"
  END


  WEB
    METADATA
        "wfs_title"                 "WFS"
        "wfs_onlineresource"        "#host#/BMapr/api/Ogc/#project#?"
        "wfs_srs"                   "EPSG:4326 EPSG:3857 EPSG:21781"
        "wfs_abstract"              "This text describes my WFS service."
        "wfs_enable_request"        "*"
        "wfs_getfeature_formatlist" "geojson"
    END
  END

  
LAYER
  NAME "Test-FGB"
  CONNECTIONTYPE flatgeobuf
  DATA "C:/test.fgb"
  STATUS ON
  TYPE line

  PROJECTION
    "init=epsg:4326"
  END
END


LAYER
  NAME "Test-FGBOGR"
  CONNECTIONTYPE OGR
  CONNECTION "C:/test.fgb"
  Data "Street-FGBOGR"
  STATUS ON
  TYPE line
  DEBUG 5
  
  PROJECTION
    "init=epsg:4326"
  END
END
  
END

This works: http://localhost/api/Ogc/wfstest?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=Test-FGBOGR&SRSNAME=EPSG%3A4326&OUTPUTFORMAT=geojson

This does not work while ms_error.log keeps empty: http://localhost/api/Ogc/wfstest?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=Test-FGB&SRSNAME=EPSG%3A4326&OUTPUTFORMAT=geojson

@bjornharrtell
Copy link
Contributor

Sorry to hear it doesn't work. When I implemented it I mostly tested rendering but I think feature access worked too... can you try with a geojson with only a single geometry type and see if that has any effect?

@bad-ch
Copy link
Author

bad-ch commented May 25, 2023

By the way I append the problematic file, perhaps it helps you to find out whats wrong with it. This flatgeobuf file is produced by QGIS, the orginal source was a shape file.

bb.zip

@CaptainInler
Copy link

@bjornharrtell as you mentioned, the problem only seems to occur when there are multiple geometry types in the flatgeobuf. I was able to successfully query a fgb with multiple linestrings using the native flatgeobuf driver. As soon as I add another type, e.g. polygon, the response remains empty.

@bjornharrtell bjornharrtell changed the title Native FlatGeoBuf from MapServer is not working Native FlatGeoBuf from MapServer is not working for files with non specific geometry type May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants