FlatGeobuf 和 Geobuf


参考:

https://gdal.org/drivers/vector/flatgeobuf.html

https://github.com/bjornharrtell/flatgeobuf


https://github.com/mapbox/geobuf

https://www.cnblogs.com/jyughynj/p/11567569.html


Examples

  • Simple translation of a single shapefile into a FlatGeobuf file. The file ‘filename.fgb’ will be created with the features from abc.shp and attributes from abc.dbf. The file filename.fgb must not already exist, as it will be created.

    % ogr2ogr -f FlatGeobuf filename.fgb abc.shp
  • 
    
  • Conversion of a Geopackage file with multiple layers:

    % ogr2ogr -f FlatGeobuf my_fgb_dataset input.gpkg
  • 
    

See Also


  • geojsonp — the prototype that led to this project
  • pygeobuf — Python implementation of Geobuf
  • twkb — a geospatial binary encoding that doesn't support topology and doesn't encode any non-geographic properties besides id
  • vector-tile-spec
  • topojson — an extension of GeoJSON that supports topology
  • WKT and WKB — popular in databases
  • EWKB — a popular superset of WKB


修改源码:

! function (t, e) {
  if ("object" == typeof exports && "undefined" != typeof module) {
    e(exports, require("ol/Feature"), require("ol/geom/Point"), require("ol/geom/MultiPoint"), require("ol/geom/LineString"), require("ol/geom/MultiLineString"), require("ol/geom/Polygon"), require("ol/geom/MultiPolygon"));
  } else {
    //if ("function" == typeof define && define.amd) {
    //  define(["exports", "ol/Feature", "ol/geom/Point", "ol/geom/MultiPoint", "ol/geom/LineString", "ol/geom/MultiLineString", "ol/geom/Polygon", "ol/geom/MultiPolygon"], e);
    //} else {
      e((t = t || self).flatgeobuf = {}, t.ol.Feature, t.ol.geom.Point, t.ol.geom.MultiPoint, t.ol.geom.LineString, t.ol.geom.MultiLineString, t.ol.geom.Polygon, t.ol.geom.MultiPolygon);
    //}
  }
}


应用:

import  'flatgeobuf';
//import  flatgeobuf from 'flatgeobuf';

//

const response = await fetch('widgets/common/zonenavi/data/UScounties.fgb');

for await (let feature of flatgeobuf.deserialize(response.body)) {

  feature.getGeometry().transform('EPSG:4326', 'EPSG:3857');

  this.addFeature(feature);

}

你可能感兴趣的:(FlatGeobuf 和 Geobuf)