Using FlatCityBuf with WebAssembly

Table of contents

  1. Install for JavaScript/TypeScript (npm)
  2. Using FlatCityBuf in the browser (WASM)

Install for JavaScript/TypeScript (npm)

npm install @cityjson/flatcitybuf

Using FlatCityBuf in the browser (WASM)

FlatCityBuf provides WebAssembly bindings for efficient CityJSON processing in web browsers.

Setup and installation

Install the npm package:

npm init -y # create package.json file
npm install @cityjson/flatcitybuf

Or include it in your package.json:

{
  "dependencies": {
    "@cityjson/flatcitybuf": "^0.2.0"
  }
}

Reading FCB files over HTTP

Create a file called index.html and paste the following code into it. Open the HTML file in your browser and you’ll see the UI like this: HTML to interact with FlatCityBuf over HTTP

You can test it to fetch data with bounding box or attribute query.

You can download the complete HTML file here: fcb_demo.html