Hitz for Craft CMS

Import, export and JSON

All of this is Hitz Pro, and in the control panel it needs the Import and export plans permission.

GeoJSON export

Designer → Import / export → Export GeoJSON downloads the plan as a FeatureCollection:

{
  "type": "FeatureCollection",
  "hitz": { "version": 1, "plan": "spring-fair", "width": 120.0, "height": 80.0, "unit": "m", "axis": "x-right-y-down" },
  "features": [
    {
      "type": "Feature",
      "id": "A-01",
      "properties": { "code": "A-01", "title": "Northwind Coffee", "type": "stand", "kind": "stand", "availability": "booked", "surface": 24.0, "enabled": true, "hitz:shape": "rectangle" },
      "geometry": { "type": "Polygon", "coordinates": [[[6, 7], [12, 7], [12, 11], [6, 11], [6, 7]]] }
    }
  ]
}

Coordinates are plan units, y down — not longitude and latitude. That is legal GeoJSON (a local grid by prior arrangement) and it is what QGIS, AutoCAD Map and friends expect when told the file is in a local coordinate system. Circles are written as 48-sided polygons and carry hitz:circle so they come back as circles.

GeoJSON import

Import GeoJSON… reads a FeatureCollection onto the open plan:

  • a feature whose code matches an area updates it (shape, type, title, availability, enabled);
  • a feature with no code matches a code-less area of the same type and title — so re-importing a plan's own export changes nothing;
  • anything else is created, numbered as if it had been drawn;
  • nothing is ever deleted.

type is an area-type handle; unknown or missing types fall back to the first stand type. Only Polygon (the outer ring) and the first polygon of a MultiPolygon are read.

Typical uses: tracing a venue's CAD drawing in QGIS once and importing it, copying one year's plan into next year's, and bulk-updating availability from a script.

Stands CSV

Export stands (CSV) is the sales team's spreadsheet: code, title, type, hall, availability, surface, dimensions, enabled. Cells that would run as spreadsheet formulas (=, +, -, @) are prefixed with '.

JSON endpoint

Turn on Settings → Hitz → JSON endpoint and every enabled plan is served at:

GET /hitz/plans/<slug>.json
GET /hitz/plans/<slug>.json?types=stand,facility

The response is exactly what the front-end viewer reads (craft.hitz.planData()): the frame, the area types, the availability legend and every enabled area — geometry, code, title, colour, surface, availability and anything added through EVENT_DEFINE_AREA_DATA. No CP URLs, no field values you did not choose to add. It sends Access-Control-Allow-Origin: * so an event app can read it directly.

Off by default: a site should choose to publish its plan as a feed, not discover it has been.

Console

php craft hitz/plans/list
php craft hitz/plans/export spring-fair                                  # GeoJSON to stdout
php craft hitz/plans/export spring-fair --format=csv --file=stands.csv
php craft hitz/plans/import spring-fair venue.geojson
php craft hitz/plans/rehome spring-fair                                  # re-derive halls

list and rehome work in Lite. import exits non-zero if any feature was skipped.