ICT:Cargo Geo Coordinnates
Appearance
Handling Geographical Coordinates in Cargo
Geographical data is stored using the Coordinates field type. This allows for both precise database storage and interactive map displays using Page Forms and Cargo.
1. Define the Cargo Table
In your table declaration, use the `Coordinates` field type.
{{#cargo_declare:_table=Places
|Name=String
|Location=Coordinates
}}
2. Create the Input Form
Use the `leaflet` input type (part of Extension:Page Forms) to provide an interactive map where users can click to set coordinates.
{{{field|Location|input type=leaflet|height=300|width=500}}}
3. Displaying Maps
Display a map for a single location
Use the `#cargo_display_map` function on the page itself to show where the specific place is located.
{{#cargo_display_map:
|point={{{Location|}}}
|service=leaflet
|zoom=14
|height=400
}}
Display all places on a master map
To show all entries from your `Places` table on one map, use a `#cargo_query` with a map format.
{{#cargo_query:
|tables=Places
|fields=_pageName=Page, Name, Location
|format=leaflet
|height=500
}}
Technical Note: Coordinate Format
- Storage: Cargo stores coordinates as "Latitude, Longitude" in decimal degrees (e.g., `51.2194, 2.8972`).
- Precision: Ensure you use a period (`.`) for decimals and a comma (`,`) to separate the two values.
- Services: While `leaflet` is recommended for its ease of use, you can also use `googlemaps` or `openlayers` if they are configured on your wiki.