Publishing a CSW endpoint from CKAN with pycsw for GIS clients and geoportals
For a CKAN team whose GIS desktops and external geoportals need to query the catalog over OGC Catalogue Service for the Web (CSW), the supported bridge is the pycsw commands provided by ckanext-spatial. pycsw serves the geospatial metadata through CSW, while CKAN stays the system of record where datasets are created, edited and approved. The integration does not make CKAN itself a CSW server. CKAN keeps its own web interface and API, and pycsw runs as a separate service that answers standard CSW requests such as capability checks, record queries and single-record lookups. Confirm the exact command names, configuration keys and supported pycsw version against the ckanext-spatial and pycsw documentation for the versions you run, since these change between releases.
The sync is the part that decides whether the endpoint can be trusted. pycsw answers from its own database of records, so every create, update, delete and privacy change in CKAN must reach that database through a scheduled or triggered run of the pycsw commands. Ask your team to confirm how a run is triggered, how deleted and private datasets are handled, and what the job logs when it fails. Test those three cases on a staging catalog before any outside client is pointed at the endpoint. A stale or exposed record is a visible error to GIS users, so sync monitoring belongs in the endpoint's runbook from day one.
Decide ownership before go-live. The platform team usually owns the pycsw service, its database, TLS termination, access logging and upgrades, while the catalog team owns which datasets and metadata profiles are eligible for publication. Because external geoportals will reach the endpoint, decide whether it accepts anonymous requests and what logging and rate limiting sit in front of it, and confirm with your security team how the endpoint is covered in your testing scope. Plan a retest after any CKAN or pycsw upgrade, since the metadata clients receive can change even when the CSW interface looks the same.
What a CKAN to pycsw CSW setup needs before work starts
Settle these six items before anyone edits CKAN or pycsw configuration. Together they decide whether the CSW endpoint can be published, whether its records carry usable spatial extents, and whether the catalog can stay in sync after launch.
CKAN minor line and ckanext-spatial pairing
The CKAN tech team supports the latest patch of the current minor version and the previous minor version, so start from one of those two lines. Then confirm which ckanext-spatial release matches the chosen CKAN minor before installing anything. A mismatched extension can fail on the pycsw commands or on the spatial fields they read. Record the pairing in your change plan so the upgrade path is clear later.
CKAN release policyPython and PostgreSQL runtimes
The CKAN source install requires Python 3.10 or newer and PostgreSQL 12 or newer. Confirm that the operating system packages on the CKAN host provide these versions, or that your container base image does. Check the PostgreSQL version on the CKAN database host, because the spatial commands run against the same CKAN data. Ask your platform team who owns patching for both runtimes.
CKAN source install guideSolr with indexed dataset extents
CKAN recommends Solr 9, and Solr 8 is also supported. Before the CSW work starts, confirm that spatial dataset extents are already indexed in Solr. Pycsw publishes what CKAN supplies, so datasets with missing or unindexed extents will appear in the catalog without usable bounding boxes. Run a bounding box search in the CKAN interface to check that the index returns the datasets you expect.
Separate pycsw installation and database
Pycsw runs as its own installation, separate from the CKAN virtual environment, with its own Python environment and its own database for the catalog records. Decide where it runs, whether a dedicated virtual machine, a container or a shared service host, and who owns its upgrades. Confirm the pycsw version that the chosen ckanext-spatial release expects, and confirm the database backend it supports before provisioning.
Service account and configuration file permissions
Run pycsw under a dedicated service account that is not used by CKAN or by interactive administrators. The pycsw configuration file holds database credentials, so make it readable by the service account and the web process only. Assign write access to the account that runs the sync commands, and document who may change the configuration. Review these permissions before the first harvest or sync writes records.
Network rules and the TLS reverse proxy
Map every connection before opening any firewall rule. CKAN must reach Solr and the pycsw database, the pycsw host must reach the CKAN API it reads from, and GIS clients should reach pycsw only through the public path. Place a reverse proxy with TLS in front of that path, and confirm the certificate chain and the public URL that clients will register. Keep the database and Solr ports closed to client networks.
How dataset metadata moves from CKAN to a CSW client
The diagram starts at the two stores that hold CKAN's dataset records: the CKAN PostgreSQL database and the Solr index. The ckanext-spatial pycsw load step reads from both and writes into the pycsw repository database, which sits in the public CSW zone, so this hand-off is the trust boundary to check. The load runs on a schedule, which is the scheduled sync path. Requests take the on-demand path in the other direction: GIS clients and geoportal harvesters send CSW requests through the reverse proxy to the endpoint, which answers from the repository database. Check that the public zone can reach only the repository and endpoint, and that nothing in the CKAN zone accepts inbound traffic from it.
Scheduled sync and on-demand requests use separate paths across the trust boundary.
Configuring the CSW endpoint from CKAN step by step
This sequence takes a CKAN portal with spatial datasets to a CSW endpoint that GIS clients and geoportals can query. Each step ends with a check you can run before moving on, so a fault shows up where it was introduced. Exact command names and configuration keys come from the ckanext-spatial and pycsw documentation, so confirm them against the versions you install.
Install ckanext-spatial and pycsw in matching versions
Your platform or infrastructure team installs ckanext-spatial into the same Python environment as your CKAN instance, then installs pycsw alongside it. Choose ckanext-spatial and pycsw versions that the extension documentation lists as compatible with your CKAN release, and record both in your change log. Confirm the package names and installation commands in the ckanext-spatial documentation before you run anything in production. Done means CKAN starts with the extension loaded and no errors in its logs, and pycsw reports its version from the same environment.
Create the pycsw configuration file and database
Create a pycsw configuration file on the CKAN host with the database connection, the service identification fields and the contact details your organization wants published. Give pycsw its own database, separate from the CKAN database, and create a database user that holds only the rights pycsw needs. Confirm the configuration keys, the supported database engines and the table setup command in the pycsw documentation. Done means the setup command finishes without errors and the database contains the tables pycsw expects, which you can list with your database client.
Point CKAN at the pycsw configuration
Add the path to the pycsw configuration file and the related CSW settings to the CKAN configuration file your deployment uses, following the keys documented for ckanext-spatial. Restart CKAN's web and background worker processes so the change loads, because running processes keep their old settings. Confirm the exact configuration keys in the ckanext-spatial documentation, since key names can change between extension releases. Done means CKAN starts cleanly and its logs show the spatial extension loaded with the pycsw configuration path you set.
Run the initial load of spatial datasets
Run the ckanext-spatial command that writes CKAN's spatial datasets into the pycsw database. Start with a small test batch of datasets whose extents you know are correct, and check that each one has a valid spatial extent and a metadata identifier, because records without them are hard for clients to find over CSW. Confirm the command name and its options in the extension documentation, and run the full load only after the test batch shows the records you expect. Done means the record count in the pycsw database matches the test batch, and one record returns its title and bounding box intact.
Expose the CSW path through the reverse proxy
Configure your reverse proxy to forward the CSW path to the pycsw application, and apply the same TLS and access rules you use for the rest of the portal. Decide whether the endpoint is public or limited to named networks, and confirm the decision with your security team before publishing, since a metadata catalog can still reveal internal system names. Confirm the proxy directives and the CSW path in the pycsw documentation. Done means an HTTPS request to the public CSW URL returns an XML response from pycsw, and a CKAN error page or a 404 tells you the proxy rule needs correction.
Run GetCapabilities and GetRecords checks
Send a GetCapabilities request to the endpoint and confirm the response lists the CSW version, the supported operations and the service identification you configured. Then send a GetRecords request with a simple query that returns the total record count, and compare that count with the record count in the pycsw database. If the endpoint is meant to be public, repeat both requests from a machine outside your network, and open the endpoint in a GIS client that supports CSW to confirm it lists records you recognize. Confirm the exact request syntax in the pycsw documentation. Done means both requests return valid XML with the expected operations and counts.
Keeping the CSW catalog in sync with CKAN after edits and deletes
The pycsw repository is a copy of your CKAN datasets, so a new, edited, private or deleted dataset reaches the CSW catalog only when the load or clear step runs again. Until then, GIS clients and geoportals see the old title, extent or record, and a deleted dataset can stay discoverable. Choose the sync pattern before go-live. A scheduled full reload rebuilds the repository from CKAN on a fixed interval, which is simple to reason about but takes longer as the catalog grows. Triggered updates run after a harvest finishes or a known batch of edits lands, which keeps the copy fresh with less work but only covers changes that pass through the trigger. Many teams run triggered updates for normal flow and a full reload each night to catch anything a trigger missed.
Private and unpublished datasets carry the most risk in this sync, because the CSW endpoint is publicly reachable. Test the boundary before go-live: create a private dataset and a draft, run the load, then query the CSW repository for their identifiers and confirm neither appears. Confirm how your ckanext-spatial version treats the private flag and dataset state during load, and do not assume the default is safe. If the load does not filter these out, add a selection step that loads only public, active datasets, and record it in the runbook. Make visibility changes part of the test too, because turning a public dataset private is a common edit that an incremental load can miss. Rerun this check after every CKAN or extension upgrade, since the behavior can change between versions.
Detect drift by comparing record counts between CKAN and the CSW catalog on a schedule, and alert when they diverge. Count the public, active datasets that carry a spatial extent in CKAN, since those are the records the load should produce, then count the records in the CSW repository and compare the totals. A matching count does not prove matching content, so also spot-check a sample of identifiers and titles after edits. Expect a short lag after each trigger and a larger gap after a failed load, so the check should log its timestamp and the last successful load. The sync design rests on the ckanext-spatial behavior you confirmed for your version, including whether the CSW repository drops records deleted in CKAN and whether the count should include them. Keep the comparison in the runbook with a named owner, so every mismatch gets investigated and closed.
How CKAN dataset fields map to CSW record fields
This table compares the CKAN dataset fields that a CSW endpoint exposes with the CSW or ISO elements they appear as in a published record. Read each row as a check to run on sample records before the endpoint goes live. Where the ckanext-spatial documentation does not confirm a mapping, list it as an item to verify against sample records, and check scheme-dependent mappings separately for each metadata scheme in use.
| CKAN field | CSW or ISO element | Check to run |
|---|---|---|
| Title | Title element of the CSW record; confirm the exact element name in the ckanext-spatial docs | Query one sample dataset and check that the returned title matches the CKAN title. |
| Description | Abstract element of the CSW record; verify the mapping against sample records | Compare the abstract with the CKAN notes field, including line breaks and any markup that is stripped. |
| Tags | Keyword or subject elements; verify which elements carry CKAN tags | Check that each tag appears in the record and that tags with spaces or punctuation export intact. |
| Spatial extent | Bounding box element; verify the coordinate order and CRS in sample records | Compare the extent with the bounding box in the CKAN spatial field and confirm the coordinate order. |
| Temporal extent | Temporal extent element; list as an item to verify against sample records | Confirm which CKAN date fields feed the record, then test a dataset that has both a start and an end date. |
| Organization or contact | Contact or point-of-contact element; verify the role and the organization name | Check that the contact shown in the record matches the CKAN organization, and that any contact details exposed publicly are approved for release. |
| License | Use or rights constraint element; verify whether the license identifier or title is exported | Confirm the license identifier or text in the record matches the CKAN license and that the field is populated. |
| Resource links | Online resource or distribution element; verify the URL and protocol for each resource | Open each exported link from a sample record and confirm it resolves to the matching CKAN resource. |
| Scheme-dependent fields | Elements from ISO 19139 based extras depend on the scheme configured for each dataset | List each extra, its target element and the scheme it applies to, then test one record per scheme. |
Hardening the CSW endpoint for public and internal clients
Publishing CSW exposes your catalog to anyone who can reach the endpoint, so these controls decide what clients can read, how much load they can place on CKAN, and how you find out when something goes wrong. The six cards cover transport, database rights, what the load step includes, traffic limits, logging and patching. Apply them to the public path and the internal path alike, because internal GIS clients query the same catalog.
Serve CSW only over TLS
Terminate TLS at the reverse proxy in front of pycsw, and refuse or redirect plain HTTP requests to the CSW path. Public geoportals and internal GIS clients both send catalog queries and receive metadata, so transport protection covers both. Confirm that pycsw listens only on an internal interface, so the proxy is the only way in. Check the certificate chain with the same client tools your GIS team uses, and ask your security team which TLS versions and cipher policy they require before you write the proxy configuration.
Limit the pycsw database account
Give pycsw a dedicated database role with rights only on the tables it needs, and keep CKAN's owner account out of the pycsw configuration. The pycsw configuration file holds database credentials, so it must be readable only by the service account that runs pycsw. Set those file permissions during deployment, and check them again after any configuration change. Review the role's grants whenever pycsw or ckanext-spatial changes version, since a new release can require additional rights.
Keep private and draft datasets out
The load step decides what the public catalog reveals, so filter private datasets and drafts before records reach pycsw. Their owning organizations have not chosen to publish them, and a load that includes them exposes their metadata to anonymous clients. Test the filter with one private record and one draft, then query the endpoint without credentials to confirm neither appears. Repeat that check after each scheduled load, because a change to the filter or the sync command can bring them back.
Rate limit and cap request size
CSW GetRecords requests can ask for large result sets and complex filters, which makes the public path the easiest way to load CKAN's search backend. Set request rate limits and maximum body sizes at the reverse proxy, keyed by client address, and confirm the limits with a load test before you publish the URL. Also set the record limit in the pycsw configuration. Give internal GIS clients their own allowance so a bulk harvest does not slow interactive users.
Log CSW requests with client detail
Access logs show who queried the catalog, which operations they used and how often, which you need when a harvester or partner portal misbehaves. Log at the reverse proxy and in pycsw, and record the request path, operation parameter, status code and response time. Send both logs to the same store as your CKAN logs, and agree the retention period with your security team before go-live. Confirm that logs do not capture credentials passed in query strings.
Patch on CKAN's cadence
pycsw and ckanext-spatial change the CSW surface, so they belong on the same patch calendar as CKAN. CKAN supports the latest patch of the current minor version and the previous minor version, and outdated patch releases lose support once a newer patch is out. Subscribe to CKAN releases, test the CSW endpoint and a fresh load after each update, and record the pinned pycsw and ckanext-spatial versions next to CKAN's in your change log.
CKAN release policyTesting the CSW endpoint before GIS clients and geoportals connect
Agree the acceptance criteria in writing before the first GIS client or geoportal connects to the CSW endpoint, and name who signs them off. A written list turns a vague statement that the service seems to work into a pass or fail result that the CISO, the GIS team and the harvester owner can all check. Write the criteria against the endpoint that your pycsw configuration actually exposes. Decide in advance who owns each result, who may waive a failed check, and where the test evidence is stored, so that a failed check does not become an informal exception on launch day. The plan below is the minimum set a reviewer is likely to ask about.
Begin with protocol conformance. Request GetCapabilities and confirm that the advertised operations and output schemas match what your pycsw configuration declares. Run GetRecords with a bounding box filter and a keyword filter, using test extents that include datasets inside, outside and crossing the boundary. Compare the counts with the same query run through the CKAN search API, and document any difference with its cause. Run GetRecordById on a sample of identifiers. For record content, pick datasets from each organization and each harvested source, then check titles, abstracts, keywords, extents, dates and resource links field by field against the records the endpoint returns.
Test leakage separately with an anonymous client, because a logged-in test account can hide access problems. Call every operation without credentials and confirm that private datasets, drafts and deleted records do not appear in results, hit counts or direct identifier lookups. Then connect at least one GIS desktop tool, such as QGIS or ArcGIS Pro, and the external harvester your organization uses. Record what each one reads, how often it pulls and whether it reports errors. Finally, write the retest triggers into the plan: rerun the full suite after each CKAN, pycsw or ckanext-spatial upgrade, and repeat the leakage checks after any change to dataset visibility or organization settings.
Why CSW results are empty, stale or wrong after publishing
This table lists the symptoms most often seen after a CSW endpoint goes live, with the likely cause, the first check to run and the fix. Read each row left to right and run the check before changing configuration, so you know whether CKAN, the sync job, pycsw or the proxy is failing. The main takeaway is that the logs and configuration files named here usually show the cause before any change is needed.
| Symptom | Likely cause | Check first | Fix |
|---|---|---|---|
| Empty GetRecords response after the first load | The load wrote to a different database than pycsw reads, or it did not finish | Compare the database settings in the pycsw configuration file with those used by the load command, and read the load output | Point both at the same database, rerun the load, and confirm rows exist before testing clients |
| Deleted dataset still returned by GetRecords | The removal was not synced, so the old pycsw row remains | Check the scheduled sync job log on the CKAN host for the dataset identifier | Run a full reload so pycsw rebuilds from current CKAN state, then confirm the identifier no longer appears |
| Datasets missing spatial extents in results | The dataset has no spatial extent in CKAN, or the extent is stored in a field the load step does not map | Open the dataset in CKAN and its API output, then find its record in a GetRecords response | Correct the extent or the mapping, resync that dataset, and confirm the bounding box appears in the record |
| Private datasets visible to anonymous clients | The load step does not filter on visibility, or an earlier public row was never removed | Confirm the dataset's visibility in CKAN, then query GetRecords without credentials for its identifier | Exclude private datasets from the load, remove existing rows, and retest from outside your network |
| Client errors on the reverse proxy path | The public base URL in pycsw does not match the path the proxy exposes, or the proxy rewrites it | Compare the URL the client calls with the proxy access log and the pycsw configuration file | Set the public URL to the exact proxied path, reload the proxy, and check that capabilities links resolve |
| Client errors that only some GIS tools show | The server sends its certificate without the intermediate chain, so some clients cannot validate it | Test the endpoint from outside your network with a TLS checker and inspect the certificate files on the proxy | Install the full chain on the proxy, reload it, and retest from a client that uses its own trust store |
| Errors or missing records after an upgrade | CKAN, ckanext-spatial and pycsw were upgraded separately, and their versions no longer match | List installed versions in the CKAN Python environment and compare them with each project's release notes | Pin versions that work together for your CKAN minor release, reinstall, rerun the load, and test GetCapabilities |
| Recent edits not reflected in search results | The sync job runs on a schedule, so changes made since its last run are not yet loaded | Check the time of the last successful sync in the job log, then compare it with the edit time in CKAN | Run the sync after the edit, and adjust the schedule if changes must appear sooner |
Questions buyers ask about publishing CSW from CKAN with pycsw
What drives the cost of a pycsw catalog on CKAN?
Cost follows the amount of work the catalog needs, and most of it is one-time setup plus recurring upkeep. The main drivers are the number of datasets with spatial metadata, how consistent their extents are, and how many client types must read the catalog, since each GIS client or geoportal may expect slightly different responses. The security review scope adds cost when the endpoint needs its own testing, TLS review and documentation for auditors. Upgrade cadence adds recurring cost, because each CKAN upgrade needs regression testing of the sync. You pay for hosting and for your own staff time in reviews. The partner's fee covers configuration, sync scope, testing and documentation, so ask the quote to show each part separately.
How long does publishing CSW from CKAN take?
No duration is given here, because the written scope sets the timeline for each engagement. The schedule follows the same drivers as cost: how many datasets carry spatial metadata, how much cleanup the extents need before publication, and how many client types must be tested. Your side also affects the schedule, including how quickly you grant CKAN and Solr access, how fast the named owner signs off on publication decisions, and whether the DNS and TLS path is ready. Ask for milestones that separate sample testing, the full sync run and the handover of documentation, so each stage has a visible finish point.
Can our internal team publish CSW from CKAN on its own?
Yes, an internal team can do it alone when it has solid Python and PostgreSQL operations skills and works through the setup checklist on this page. The work involves running the ckanext-spatial pycsw commands, keeping the CSW catalog in sync with CKAN, and operating the endpoint behind DNS and TLS. Teams new to Solr or Python will need time to learn those pieces first. A partner makes the most sense when the timeline is tight, when security testing of the endpoint is required, or when no one on staff will own the sync after handover. Decide this before you start, because the answer changes the scope you ask for.
What must our team provide before a CSW project starts?
Your team provides four things: access to CKAN and Solr, a sample of datasets with known good spatial metadata, a named owner for publication decisions, and a DNS and TLS path for the endpoint. Access should cover every environment where the sync will run, so test and production are both reachable if you use both. The sample matters most at the start, because it shows how your extents and records should look once published and gives testing a fixed reference point. The named owner decides which records are published, how often the catalog syncs and who signs off on changes. The DNS and TLS path should exist early, since GIS clients connect by hostname and certificate errors surface quickly in testing.
What should we ask for in a CSW publishing quote?
Ask for a written scope that names each part of the work and its deliverable. Start with the sync scope: which datasets are included, which metadata records are published, how often the catalog updates, and how deletions and changed extents are handled. Then ask how testing is done, including sample queries from each GIS client type you rely on, and what evidence is handed over at the end. Documentation should cover the setup, the sync commands, a runbook for failed syncs and the owner's responsibilities. Finally, ask for retainer options for upgrades, monitoring and continuous testing, and confirm what each one includes, since these costs recur after handover. DeployOpen's engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and the quote follows from that written scope.
How do CKAN upgrades affect a CSW endpoint?
Each CKAN upgrade can change the data the sync reads, so the CSW endpoint needs regression testing after every upgrade. CKAN's release policy says the project targets about two minor releases a year and supports the latest patch of the current minor version and the previous minor version. Outdated patch releases lose support once a newer patch is out. Patch releases do not break backwards compatibility, while minor releases may include backwards-incompatible changes, so plan minor upgrades as projects with their own testing windows. CKAN 2.12.0 was released on August 26, 2026, alongside maintenance releases 2.11.6 and 2.10.11. Confirm how upgrade testing for the CSW sync is scoped in any retainer you consider.
Which spatial metadata problems break CSW results?
Missing, malformed or inconsistent spatial extents cause the most visible problems, because GIS clients filter and map records using those fields. Check that every published dataset has an extent, that the values are in the coordinate order and reference system your clients expect, and that no record keeps placeholder geometry from an old import. Check also that titles, descriptions and keywords are complete enough for a catalog user to understand the record, since a record with a valid extent and no description still reads poorly to users. Review a sample of datasets against known good metadata before the first full sync, and keep a list of exceptions the named owner has approved. This review is a major effort driver, so ask whether it sits inside the quoted scope.
How DeployOpen scopes, delivers and supports CSW publishing for CKAN
DeployOpen plans and implements CSW publishing from CKAN inside your own infrastructure, so the catalog your GIS clients and geoportals query stays under your control. Work starts from a written scope that names the CKAN instance, the spatial datasets to publish and the clients that will connect. The same scope sets how the pycsw catalog is kept in step with CKAN after go-live.
How we scope
- The written scope lists which CKAN datasets, organizations and spatial fields are published over CSW.
- It names the CSW clients and geoportals that will harvest or query the endpoint, and the metadata they expect.
- Engagements are fixed-scope, so deliverables and timelines are agreed in writing before the build starts.
How we build
- Install pycsw beside CKAN and set its database, configuration file and public endpoint URL in your environment.
- Map CKAN dataset fields and spatial extents to ISO records through the ckanext-spatial pycsw commands, then test each mapping.
- Schedule the sync job that keeps the CSW catalog aligned with CKAN, with failure alerts in your monitoring.
How we hand over
- Test the endpoint with the GIS clients your users run, recording record counts, search results and any mapping gaps.
- Document the pycsw configuration, the ckanext-spatial settings, the sync schedule and the restore steps.
- Walk your operations team through the runbook, then confirm ownership of the endpoint, the sync job and the database.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so the endpoint is maintained after handover.
- Plan CKAN upgrades and pycsw changes together, then retest the endpoint against your GIS clients after each change.
- Ask us to confirm the response process and what the retainer covers before signing.

