Related pieces
- Reference: Locations file — full field list from the schema
- Import time series and ID mapping — where location ids and sets get used
- Concept: The configuration directory and data flow
- Schemas:
locations.xsd·locationSets.xsd
Locations are the where of your data model — the gauges, reservoirs, catchments, and grid points that every time series attaches to. They’re foundational: you declare them once, and everything else (imports, ID maps, filters, models) refers to them by id.
This guide has two halves: declaring individual locations, then grouping them into location sets so a single config line can apply to a hundred places at once.
The Locations file is a required geoDatum followed by one location per
place. Each location needs a unique id and x/y; everything else is
optional.
<?xml version="1.0" encoding="UTF-8"?><locations xmlns="http://www.wldelft.nl/fews" version="1.1"> <geoDatum>WGS 1984</geoDatum> <location id="RiverGauge_01" name="River Gauge at Town Bridge"> <shortName>TownBr</shortName> <x>4.895</x> <y>52.370</y> <z>2.0</z> </location></locations>The fields you’ll reach for most:
| Field | Role |
|---|---|
id (attribute) | The internal id every other file references. Must be unique. |
name (attribute) | Human-readable name shown in the UI. |
shortName | Compact label for chart legends. |
x, y, z | Coordinates, interpreted in the file’s geoDatum. x/y required. |
parentLocationId | Makes this an (invisible) child of another location; children are auto-selected with the parent. |
visibilityPeriod | Time-limit when the location appears in the UI — good for decommissioned sites. |
A location set is a named group you can refer to instead of listing
locations one by one. Its power is reuse: an import,
a filter, and a model can all target AllDischargeGauges, and adding a gauge to
that set updates all three at once.
A locationSet has an id and defines its members one of several ways. Here are
the four you’ll actually use:
List member ids directly. Simple and obvious for small, stable groups:
<locationSets xmlns="http://www.wldelft.nl/fews" version="1.1"> <locationSet id="AllDischargeGauges"> <locationId>RiverGauge_01</locationId> <locationId>RiverGauge_02</locationId> </locationSet></locationSets>Build a set out of other sets with locationSetId — combine and reuse without
re-listing:
<locationSet id="AllGauges"> <locationSetId>DischargeGauges</locationSetId> <locationSetId>LevelGauges</locationSetId></locationSet>For hundreds of locations, don’t hand-write them — point the set at a CSV, shapefile, GeoJSON, GeoPackage, or database table. The file supplies the members (and can carry attributes):
<locationSet id="AllGauges"> <csvFile> <file>gauges.csv</file> <geoDatum>WGS 1984</geoDatum> </csvFile></locationSet>The equivalent elements for other sources are esriShapeFile, geoJsonFile,
geoPackageFile, and table.
Select members by rule instead of by name. constraints supports id- and
attribute-based tests plus boolean logic, so the set updates itself as locations
change:
<locationSet id="RiverGaugesInBasinX"> <locationId>*</locationId> <constraints> <allValid> <idStartsWith> <startsWith>RiverGauge_</startsWith> </idStartsWith> <attributeTextEquals> <id>BASIN</id> <equals>X</equals> </attributeTextEquals> </allValid> </constraints></locationSet>Selectors include idStartsWith / idEndsWith / idContains,
attributeExists, attributeTextEquals / attributeTextContains, and the
combinators not / anyValid / allValid.
Constraints and displays often key off attributes — arbitrary properties like
BASIN, RIVER, or OWNER attached to a location. In this schema, attributes
come in through a location set, not inline on <location>: the columns of a
csvFile, the fields of an esriShapeFile, or a dedicated attributeFile
attached to the set. Once attributes exist, attributeTextEquals and friends can
select on them, which is what makes dynamic sets useful.
Locations file plus explicit-list sets.
Clear and low-ceremony.AllGauges =
DischargeGauges + LevelGauges) so each location is listed once.Locations file. (A set can opt into skipDuplicateIds when merging
sources, but source data should still be clean.)locationSetId
that isn’t defined won’t resolve. Define the set first.geoDatum and coordinate datum must agree. Coordinates are interpreted in
the declared datum; the wrong datum puts locations in the wrong place.allowEmptyLocationSets exists to permit
it deliberately — don’t set it just to silence the symptom.Locations 1.01 default.xml if edits aren’t taking. See how FEWS finds a
file.locationSetId and confirm it
resolves to the locations you expect.Related pieces
locations.xsd · locationSets.xsd