Skip to content

Line by Line GeoJSON Format

Neil Rotstan edited this page Jul 1, 2020 · 7 revisions

There are a couple of scenarios where using a single GeoJSON file to represent an entire Challenge may not be ideal:

  • the structure of traditional GeoJSON files isn't conducive to streaming, resulting in files being pulled completely into memory during task creation and thus limiting the size of files that can be processed

  • the GeoJSON spec does not allow FeatureCollections to be nested within other FeatureCollections, which means that it's not possible for a single task to contain multiple features with their own sets of properties to identify things like their OSM ids (you would have to use a GeometryCollection, and all the geometries in the collection share a single set of properties)

For challenges containing more than a small number of tasks -- or where multiple Features per task or other advanced features are desired -- we recommend an alternative, RFC 7464 compliant line-by-line format instead. Each line in the file should represent a standalone FeatureCollection JSON object that encapsulates a single task. During processing, only one line of the file need be pulled into memory and parsed at a time, making it possible to support very large files. And, since each task is represented by a FeatureCollection, it's possible to support multiple individual Features with their own properties (and thus OSM ids) within the task.

As of MapRoulette v3.6.5, each line of the file should begin with a RFC 7464 record separator (RS) character (1E hex), represented in the JSON example below as <RS>.

As a simple example, a line-by-line GeoJSON file with three tasks might look like this:

<RS>{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-82.9908295,42.435009]},"properties":{"address":"13001 East Seven Mile","latitude":"42.435009","longitude":"-82.9908295","business_name":"Lions Auto Sales"}}]}
<RS>{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-82.94074,42.42207]},"properties":{"address":"10709 Morang","latitude":"42.42207","longitude":"-82.94074","business_name":"Great Lakes Investment"}}]}
<RS>{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-83.129097,42.3111]},"properties":{"address":"8118 West Vernor","latitude":"42.3111","longitude":"-83.129097","business_name":"St. Gabriel Church"}}]}

Note: Older versions of MapRoulette did not support the RFC 7464 record separator, which could lead to indeterminate outcomes in some situations. MapRoulette will still accept older line-by-line files that omit the RS, but the mentioned problems will continue to potentially affect processing of those files. It is highly recommended that any new line-by-line GeoJSON files make use of the record separators unless compatibility with an older version of MapRoulette is absolutely required.

MapRoulette automatically detects the line-by-line format when processing GeoJSON files, so there is no need to use a special file extension or otherwise indicate that a file uses line-by-line formatting.

Clone this wiki locally