Skip to content

[scolv] Add Nearby Cities tab#114

Open
comoglu wants to merge 2 commits intoSeisComP:mainfrom
comoglu:feature/nearby-cities
Open

[scolv] Add Nearby Cities tab#114
comoglu wants to merge 2 commits intoSeisComP:mainfrom
comoglu:feature/nearby-cities

Conversation

@comoglu
Copy link
Copy Markdown
Contributor

@comoglu comoglu commented Apr 13, 2026

Adds a Nearby Cities tab to scolv that lists cities near the current origin, sorted by distance, and allows setting a descriptive region name on the event without leaving scolv.

Depends on: SeisComP/common#189 — extends CityD with country, AdminRegion (state) and type. This PR should be merged after that one.

Features

  • Table showing Name, Type, Region, Country, Distance (km), Direction, Population and capital flag (★)
  • Capital cities rendered in bold
  • 16-point compass direction
  • Correct numeric sorting on Distance and Population columns
  • Set as Region Name — sets a REGION_NAME EventDescription on the current event via notifier to the EVENT messaging group; five selectable format templates
  • Cities sourced from the built-in cities.xml via SCApp->cities() — no external file dependency

Configuration (scolv.cfg)

Parameter Default Description
cities.maxDist 1000 km Search radius around origin
cities.maxCount 20 Maximum cities displayed
cities.minPopulation 10000 Minimum population (capitals always shown)
cities.useFullState true Show full region name vs abbreviation; falls back to country name when no region available

Region column display logic

City data useFullState=true useFullState=false
Has state with abbr and name Full name (e.g. "New South Wales") Abbreviation (e.g. "NSW")
Has state with name only Full name Full name
No state, has country Country name (e.g. "Türkiye") Country name

Relationship to cities.xml

cities.xml currently carries name, lat/lon, population, countryID, category, country, state and type. The enrichment tooling is available at https://github.com/comoglu/cities-xml-update.

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 13, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @gempa-lukas on file. Please follow https://github.com/GEOFON/CLA/blob/master/README.md to get yourself added.

@gempa-jabe
Copy link
Copy Markdown
Contributor

Can you please rebase against the latest main branch? This PR includes dozen of old commits.

@comoglu comoglu force-pushed the feature/nearby-cities branch from cb60a80 to 33d325e Compare April 13, 2026 07:45
@cla-bot cla-bot Bot added the cla-signed The CLA has been signed by all contributors label Apr 13, 2026
@comoglu
Copy link
Copy Markdown
Contributor Author

comoglu commented Apr 13, 2026

Done

@gempa-jabe
Copy link
Copy Markdown
Contributor

@cla-bot check

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 13, 2026

The cla-bot has been summoned, and re-checked this pull request!

@gempa-jabe
Copy link
Copy Markdown
Contributor

Actually I am not in favour of adding an additional JSON file as dependency to make that work. Adding the missing attributes to cities.xml might be the better option but I am not sure right now if we could gather all the required information from the data sources?

@comoglu
Copy link
Copy Markdown
Contributor Author

comoglu commented Apr 13, 2026

I had the same worry, but I didn't want to change cities.xml because it has been there for a long time. It might be time for it to change.

@gempa-jabe
Copy link
Copy Markdown
Contributor

You have updated the content some time ago anyway. So I don't see an issue with extending its model to other attributes. Not sure how big this XML will get afterwards and if it is worth to keep an XML file at all or if it would be better to use an SQLite3 database. The XML file could take an (tremendous) amount of memory at each client who is reading it. Dealing with another source of information, even in the MariaDB/PostgreSQL database itself, could be a better approach. As you say, it has been there for a long time and sometimes things are about to change for the better.

@comoglu
Copy link
Copy Markdown
Contributor Author

comoglu commented Apr 13, 2026

Yes, I'm adding more to the XML content. I use the same source to update the current XML file. Let me see how big it can get.

@comoglu
Copy link
Copy Markdown
Contributor Author

comoglu commented Apr 13, 2026

I will be touching coord.h and coord.cpp to add new fields as well.

Adds a Nearby Cities tab to scolv that lists cities and locations near
the current origin, sorted by distance. The tab provides a convenient
way to select a descriptive region name and set it on the event without
leaving scolv.

Cities are sourced exclusively from the built-in cities.xml via
SCApp->cities(). The CityD struct has been extended in seiscomp/common
(see feature/cityd-state-type) to carry type, state and stateFull
attributes enriched from GeoNames and Natural Earth data.

Features:
- Table showing Name, Type, State, Country, Distance (km), Direction,
  Population and capital flag (★); capital cities rendered in bold
- 16-point compass direction
- Correct numeric sorting on Distance and Population columns
- "Set as Region Name" button sets a REGION_NAME EventDescription on
  the current event via notifier to the EVENT messaging group
- Five selectable region name format templates
- "Full state name" toggle switches between stateFull and state

Configuration (cities.* in scolv.cfg):
  maxDist          Maximum search radius in km (default: 1000)
  maxCount         Maximum cities displayed (default: 20)
  minPopulation    Minimum population filter (default: 10000)
  useFullState     Show full state name vs abbreviation (default: true)
@comoglu comoglu force-pushed the feature/nearby-cities branch from 33d325e to c57dead Compare April 13, 2026 10:30
- Use city.adminRegion() instead of deprecated state()/stateFull()
- Fall back to city.country() in Region column when no admin region set
- Rename column header "State" to "Region"
- Update useFullState config description
@comoglu comoglu changed the title Feature/nearby cities [scolv] Add Nearby Cities tab Apr 13, 2026
@comoglu
Copy link
Copy Markdown
Contributor Author

comoglu commented Apr 16, 2026

You have updated the content some time ago anyway. So I don't see an issue with extending its model to other attributes. Not sure how big this XML will get afterwards and if it is worth to keep an XML file at all or if it would be better to use an SQLite3 database. The XML file could take an (tremendous) amount of memory at each client who is reading it. Dealing with another source of information, even in the MariaDB/PostgreSQL database itself, could be a better approach. As you say, it has been there for a long time and sometimes things are about to change for the better.

the cities XML is now ~18MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed by all contributors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants