capetown

package module
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 3 Imported by: 0

README

capetown-opendata

Go Reference Go

Named layer IDs and pre-built queries for the City of Cape Town Open Data Portal, on top of go-arcgis.

import (
    arcgis "github.com/richardwooding/go-arcgis"
    capetown "github.com/richardwooding/capetown-opendata"
)

client := arcgis.NewClient(capetown.BaseURL)

// Pre-built, optionally refined
features, err := client.Layer(capetown.LayerLoadSheddingBlocks).Query().
    From(capetown.LoadSheddingBlocksForStage(4)).
    WithinEnvelope(18.4, -34.0, 18.6, -33.8).
    All(ctx)

Install

go get github.com/richardwooding/capetown-opendata

Requires Go 1.26+. Depends only on go-arcgis.

What's here

  • BaseURL — the CCT Open Data Feature Service endpoint.
  • Named layer constants (LayerLoadSheddingBlocks, LayerWards, LayerLandParcels, LayerTaxiRoutes, LayerWaterQuality, …).
  • Pre-built arcgis.QueryParams constructors with sensible default fields and ordering: LoadSheddingBlocks, LoadSheddingBlocksForStage, ServiceRequests, ServiceRequestsBySuburb, Wards, LandParcels, TaxiRoutes, WaterQualityResults.

Each constructor returns a plain arcgis.QueryParams, so you can run it directly or refine it through the go-arcgis fluent builder via .From(...).

A note on layer IDs

The layer IDs here are best-effort and may drift as the upstream service is republished. Confirm them against the live service with Client.ServiceInfo if accuracy matters:

info, _ := arcgis.NewClient(capetown.BaseURL).ServiceInfo(ctx)
for _, l := range info.Layers {
    fmt.Println(l.ID, l.Name)
}

Changelog

See CHANGELOG.md.

License

MIT

Documentation

Overview

Package capetown provides named layer IDs and pre-built QueryParams for the City of Cape Town Open Data Portal.

Base URL: https://citymaps.capetown.gov.za/agsext/rest/services/Theme_Based/Open_Data_Service/FeatureServer

The pre-built queries deliberately do not pin an output field list. The upstream layer schemas drift and use non-obvious column names, so each query returns the layer's full field set; callers select fields explicitly when they want a smaller payload. Filters (suburb, ordering) reference field names verified against the live service.

Layer IDs are best-effort and may drift as the service is republished. The integration test (run with -tags=integration) validates every layer ID and filter field against the live service. Use a github.com/richardwooding/go-arcgis.Client with ServiceInfo to confirm them at runtime.

Index

Constants

View Source
const (
	LayerLoadSheddingBlocks = 138
	LayerWards              = 78
	LayerLandParcels        = 56
	LayerTaxiRoutes         = 97
	LayerPublicLighting     = 3
	LayerWaterQuality       = 229
	LayerHeritageInventory  = 49
)

Layer IDs for well-known CCT datasets, validated against the live service.

View Source
const BaseURL = "https://citymaps.capetown.gov.za/agsext/rest/services/Theme_Based/Open_Data_Service/FeatureServer"

BaseURL is the City of Cape Town Open Data Feature Service endpoint.

Variables

This section is empty.

Functions

func LandParcels

func LandParcels() arcgis.QueryParams

LandParcels returns cadastral land parcel (erf) polygons.

func LandParcelsBySuburb added in v0.1.2

func LandParcelsBySuburb(suburb string) arcgis.QueryParams

LandParcelsBySuburb filters land parcels by official suburb name.

func LoadSheddingBlocks

func LoadSheddingBlocks() arcgis.QueryParams

LoadSheddingBlocks returns all load shedding block polygons. The layer carries only block geometry and a BlockID; it has no stage or suburb attribute.

func TaxiRoutes

func TaxiRoutes() arcgis.QueryParams

TaxiRoutes returns all registered minibus taxi routes.

func Wards

func Wards() arcgis.QueryParams

Wards returns all municipal ward boundaries.

func WaterQualityResults

func WaterQualityResults() arcgis.QueryParams

WaterQualityResults returns inland water quality measurements, most recent first. It targets the raw results table (sample point, date, parameter, value).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL