Introduction
The GeoJSON format is part of the open JSON (JavaScript Object Notation)
specification. FME Server allows users to easily create a spatial data service in the GeoJSON format. The example below shows how to use FME Server to create a GeoJSON spatial data web service from a data source in any of the hundreds of formats FME can read. If you are considering creating an GeoJSON Service with FME Server you may also want to have a look at a similar article which deals with streaming XML with FME Server here:
For web developers, we also show the basic syntax for requesting data from an FME Server GeoJSON web service. The second part of the demo shows a simple JavaScript example where we request data from our GeoJSON service for use in an OpenLayers map.
You can view a live version of the Open Layers Map which includes two GeoJSON layers provided by FME Server:
Use View Source in your browser to see the syntax for requesting data from an FME Server Data Streaming Service.
Basic Steps to Create the Service
1.
Create an FME workspace that reads the data you wish to serve and writes the data out in GeoJSON format. The easiest way to get started is by using the
Generate Workspace dialog in FME to select your data and format and set up the GeoJSON writer. The attached workspace uses an SDF datasource from the FME training sample dataset. You may need to project you data depending on the client application. In our example we reproject the data to EPSG:4326 for using in OpenLayers. If the data has multiple layers (feature types) the advanced writer parameter
Feature Types to Read should be published so client can ask for whichever layer is needed. Select a single layer as the default for testing.

2. Publish the workspace to FME Server ensuring that any file paths to your source data are available on the machine running FME Server. Make note of the repository you have published the workspace into. Register the workspace with the Data Streaming Service.
3. Go to the FME Server Web User Interface and browse to the Data Streaming Service and then into the repository you published the data to. Click on the workspace you published. The Run button will run the workpace and return the GeoJSON directly to your browser. FME Server will provide the GeoJSON MIME type in the response header as well: Content-Type: application/json
4.
Go back in the browser to the previous form and Click the Show Request button. This shows the url to use to request data from the service. If you change the value of the Feature Types to Read parameter and click Show Request again you will see the syntax for including this parameter in a request.
