collapse

* Forum Staff

PeterC admin PeterC
Administrator
admin webmasterOPS
Administrator

Author Topic: The input (Geo)JSON files  (Read 169 times)

PeterC

  • Administrator
  • Member
  • *****
  • Posts: 382
  • Passionate about my one-place study
    • View Profile
    • Holywell-cum-Needingworth History
The input (Geo)JSON files
« on: 15 January 2017, 11:58:05 »
Warning! This is highly technical and only relevant for someone trying to understand how M4OPS works internally. It also needs updating

Overview
M4OPS expects its input, including for feature layers, to be defined by GeoJSON and JSON files. For more on the fields, which are now generated from csv files, see Feature Layers - the CSV files.

The Main input files expected are:
  • M4OPS.json - this is not generated from csv files
  • OPS.json, generated from:
    • OPS.csv
    • LayerDefs_Feature.csv
    • LayerDefs_Other.csv
    • Abbreviations.csv
    • Exclusions.csv

The Feature Layer input files expected (for eg Censuses) are
  • Censuses.geojson – Required, contains the basic feature information, generated from:
    • Censuses.csv
    • Features.csv
    • LayerDefs_Feature.csv (?)
  • Censuses_Extras.json – Optional, contains extra feature information, generated from:
    • Censuses_Events.csv
  • Censuses_XRefs1.json – Optional, contains yet more data oriented around another aspect - the XRef (eg People), generated from:
    • Censuses_People_Events.csv
    • Censuses_People_Specs.csv
    • People.csv

Censuses.geojson
We expect our GeoJSON sources to be
  • {"type": "FeatureCollection","features": [FEATURE-ARRAY]}
Where each FEATURE (which becomes an ol.feature object) in FEATURE-ARRAY is
  • {"type": "Feature", "geometry": GEOMETRY, "properties": {PROPERTIES}}
Where the GEOMETRY is an object (one of Point, LineString, Polygon, MultiPoint, MultiLineString, and MultiPolygon) such as:And where the PROPERTIES are an object containing (with examples):
  • "featureid": 23 – Required, numeric
  • "shorttext": "My House" - Required, displays on the map when resolution is OK
  • "description": "<a href='mailto:x@example.com?Subject=Hello%20again' target='_top'>Send Mail[/url]" - html that displays in a pop up, if undefined use shorttext
  • "images": [], OR "image": "url to image to use" - becomes images[0]
  • "datestart": "1888-03-25" - preferably in ISO format, used for filtering with the time slider, if undefined use "-999-01-01"
  • "dateend": "1910" - used for filtering with the time slider, if undefined use "9999-12-31",
  • "internalnote": for internal use eg as a reminder – not displayed anywhere
  • "pin": pin number – see Creation of our software/Styles/pins for options
  • "symbol":"Beer"– see Creation of our software/Styles/symbols for options
  • "color":"blue" – colour of the circle - see Creation of our software/Styles/color
  • "radius": - size in pixels of the (filled) circle (defaults to 5)
and also these, that were in the Extras file:
  • fl_col1 - used as the value in the first column in the feature list, if undefined shorttext is used
  • fl_col2 - used as the value in the second column in the feature list
  • fl_col3 - used as the value in the third column in the feature list
  • textforsort - used for sorting the feature list, if undefined fl_col1 is used
  • Image - the relative filename of an image associated with the Feature (in the Images subfolder) Note on Extras is was Image (capitalised)
And also (from geojson.io - if overriding default - NB uses mapbox symbols under licence)
  • "marker-color":"#e13f1c",
  • "marker-size":"medium",
  • "marker-symbol":"cemetery",
  • "stroke":"#29a406",
  • "stroke-width":2,
  • "stroke-opacity":1,
  • "fill":"#142196",
  • "fill-opacity":0.5,
Note that MapHub uses the PROPERTIES:
  • "description": "# My House\n_italics_\nnormal text"
  • "title": "2 Spinney Way"  // use as the shorttext
  • "label": true   // ?indicates just text? - which we do not need?
  • "stroke": "#e32c31" // the colour of the line (but we use a standard style at present)
  • "fill": "#f18729" // the colour of the fill  (but we use a standard style at present)
  • "marker-symbol": "restaurant" // for the blob image (but we use a standard style at present)
Note that hyphens are not compatible with saving a geojson, so we use _ instead

Censuses_Extras.json
The .._Extras.json file (eg Pubs_Extras.json) has more data that ties in with the original geojson file (eg Pubs.geojson).  This enables more complex (eg Event oriented) data.

It is a single object, of the format:
  • {"FeaturesArray": [FEATURE-ARRAY], "Specification": SPECIFICATION}
Where each FEATURE in FEATURE-ARRAY is an object containing:
  • featureid: – Required, numeric
  • an EVENTSARRAY, which is an array of Events for this feature
Where each EVENT in EVENTSARRAY is an object containing:
  • evdatestart
  • evdateend
  • evshorttext
  • evdescription
Where the SPECIFICATION is an optional object containing the optional fields:
  • fl_Ncols - the number of columns in the feature list, if undefined 1 is used
  • flhead_col1 - used as the heading of the first column in the feature list, if undefined blank is used
  • flhead_col2 - used as the heading of the second column in the feature list, if undefined blank is used
  • flhead_col3 - used as the heading of the third column in the feature list, if undefined blank is used
An example of SPECIFICATION is:
  • "Specification": {"fl_Ncols": 1,"flhead_col1": "Pub name"}
   
Censuses_XRefs1.json
The .._XRefs1.json file (eg Censuses_XRefs1.json) has yet more data that ties in with the original geojson file (eg Censuses.geojson). Rather than being oriented around the Features it is oriented around another aspect - the XRef (eg People). (NB We have implemented just a single XRefs file so far)

It is a single object, of the format:
  • {" XRefsArray ": [XREFSARRAY], "Specification": SPECIFICATION}
Where each XREF in XREFSARRAY is an object containing:
  • xrefid – Required, numeric
  • xl_col1 - Required, used as the value in the first column in the xref list
  • xl_col2 - used as the value in the second column in the xref list
  • xl_col3 - used as the value in third column in the xref list
  • xlhint - (eg Birth) which is a hint on hover for the entry
  • textforsort - used for sorting the xref list, if undefined xl_col1 is used
  • "images": [], OR "image": "url to image to use" - becomes images[0]
  • "datestart": "1888-03-25" - preferably in ISO format, used for filtering with the time slider, if undefined use "-999-01-01"
  • "dateend": "1910" - used for filtering with the time slider, if undefined use "9999-12-31",
  • EventsArray: [XREFEVENTSARRAY] - an array of Events for this Xref
Where each EVENT in XREFEVENTSARRAY is an object containing:
  • featureid – Required, numeric
  • evdatestart
  • evdateend
  • evshorttext
  • evdescription
Where the SPECIFICATION is an object containing:
  • XRefName - the name by which this set of XRefs should be known
  • fnresultsHead - the href link for resultsHead (eg People) when used the string xrefid is replaced by the value of xrefid]
  • fnresultsBody - the href link for resultsBody (eg People)
  • fnresultsevHead - the href link for resultsevHead (eg Census)
  • fnresultsevBody - the href link for resultsevBody (eg Census)
  • xl_Ncols - the number of columns in the xref list, if undefined 1 is used
  • xlhead_col1 - used as the heading of the first column in the xref list, if undefined blank is used
  • xlhead_col2 - used as the heading of the second column in the xref list, if undefined blank is used
  • xlhead_col3 - used as the heading of the third column in the xref list, if undefined blank is used
An example of SPECIFICATION is:
  • "Specification": {"XRefName": "Known People","xl_Ncols": 3,"xlhead_col2": "Pid","xlhead_col3": "Forenames","xlhead_col1": "Surname"}
« Last Edit: 17 January 2017, 17:48:50 by PeterC »

 

mapping4ops.org is a Society for One-Place Studies project supported by Grassroots Giving from Skipton Building Society
Glossary | BBCodes | Feedback