Skip to content

Extend test map functionality - #30

Open
jeppekroghitk wants to merge 17 commits into
developfrom
feature/8191-extend-test-map-functionality
Open

jeppekroghitk wants to merge 17 commits into
developfrom
feature/8191-extend-test-map-functionality

Conversation

@jeppekroghitk

@jeppekroghitk jeppekroghitk commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Link to ticket

#8191

Description

  • Toggle above test-map for each dataset
  • Styled the test map so the data sets are distinguishable
  • Added clusters and click-to-zoom functionality
  • Added popup with details about the location
  • Highlighted every feature under a click, each in its own colour, and named the colours in the popup

Screenshot of the result

N/A

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

@jeppekroghitk
jeppekroghitk changed the base branch from develop to feature/8191-paginated-datacontroller September 15, 2026 11:36
@jeppekroghitk
jeppekroghitk force-pushed the feature/8191-paginated-datacontroller branch from ef6ef54 to e421114 Compare September 16, 2026 07:37
@jeppekroghitk
jeppekroghitk force-pushed the feature/8191-extend-test-map-functionality branch from b1350a1 to fa9ccb7 Compare September 16, 2026 07:39
The map drew every entity of the model as one layer in one colour, and a
click told you nothing about what you had hit. Both data sets describe the
same bays, so seeing where they agree — and what each of them says — is the
whole point of putting them on a map together.

Each test source is now a layer of its own, in its own colour, listed in a
layer switch that turns it off and on. A click opens the attributes the
entity carries, under the names the source declared.

The broker cannot serve this split: the attribute saying which source an
entity came from was expanded against a default vocabulary, which leaves it
beyond the reach of a query. So the features are fetched per model and
divided here, and the NGSI-LD Property wrappers flattened on the way out.

Overlapping geometry is handled twice over: the sources that bring areas
are drawn first so points stay on top and clickable, and the popup is
allowed more than one feature, so clicking a spot where a point hides under
a polygon reveals both rather than silently picking one.
At the previous size neighbouring bays ran together, and two points on the
same spot were one icon with no way to reach the one underneath.

Points are drawn smaller now, and a layer clusters the ones that coincide:
clicking such an icon fans them out into a grid, so each can be picked on
its own. That only reaches within a layer, which is why the popup still
takes more than one feature — a point under another data set's polygon is
reached that way rather than by the grid.
Everything here came out of looking at the map rather than at the config,
which is how most of it turned out to be wrong in the first place.

The popup never opened: its control was declared beside the map rather than
on it, and only the map has the click to hand it. The toggles never listed
anything: a layer the switch has no legend for is dropped unless told
otherwise, the data sets are the vector layers rather than all of them, and
the entries it does list stay inert without showbuttons. The toggles now
render into an element above the map, which a control is only offered when
it belongs to the map.

The popup showed the widget's own bookkeeping — the geometry, the feature
it was built from, an internal id — each rendering as "[object Object]".
Only the published attributes are listed now.

Points that coincide are drawn as one marker with a count. They were fanned
out into a grid before, which scattered them across the map and said less
than the count does; the grouping distance is a constant, since the
widget's default leaves clusters overlapping each other.

Areas carry a darker outline, so two that touch read as two. Whatever is
selected is outlined in near-black, which belongs to no data set and so
reads as "this one" wherever it lands. Points sort above areas twice over:
by z-index between layers, and by order within one, since a source can
publish both and would otherwise bury its own points.

The map is sized to what is left of the window below the heading.
The layers asked for every feature of the model on load and held the lot,
which the data will outgrow. Each now asks for the extent it is about to
draw and asks again when that changes, and the broker answers with what
falls inside it rather than with everything.

The view arrives in degrees whatever the map draws in, which happens to be
what the broker wants, so nothing is reprojected on the way.

Grouping stops once the map is close enough in for the points to stand
apart, where a marker reading "2" says less than the two points under it.
The widget handles that itself given a resolution to stop at, which also
does away with the second layer this first took.

A cluster marker is one size whatever it stands for. Scaled by its count it
grew into a disc that swallowed the streets and every feature near it, and
the number inside was already saying the same thing.

The popup carries the colour of the layer each section came from, so a
click on overlapping features says which shape on the map each one is, and
no longer lists the bookkeeping a clustered feature arrives wrapped in.
Fetching a view at a time traded away the thing the map is for: seeing
where the data sets agree and where they do not, which needs all of it
drawn. Each layer is loaded once again, and the broker is asked for the
model rather than for an extent.

A selected feature now grows as well as changes colour. A point under an
area could be restyled where nothing could see it; drawn larger it comes
out from under the shape sitting on it.

The base map keeps tiles for the zoom levels either side and room to hold
what it has already fetched, which takes some of the network out of a zoom.
A layer groups only its own features, so each data set was counting alone
and the other's points were left scattered around the markers. The points
of every data set are now served together as one layer, which is what the
counting needs, and what tells them apart there is an attribute on each
feature rather than the layer it sits in — the colour is worked out per
feature from it.

An area has no point to be grouped at, so it goes in as the middle of its
outline. Left out it would simply be missing from the count; its real shape
is drawn by its own data set's layer, close in, where it can be seen.

Those layers take over below the resolution where grouping stops, so the
two views never draw at once.

Zooming to what was clicked now stops short of its edges rather than
fitting it corner to corner.
A group says how many points are under it but not where they are, and short
of guessing at the zoom there was no way to reach them. Clicking one now
fits the map to the points it stands for, stopping short of their edges so
they do not sit against the frame. Points all at one spot have no extent to
fit, so the zoom stops at a sensible distance rather than running to the
map's limit.

The widget's loader builds the map and keeps no reference to it, so the page
builds it instead. Nothing else about the widget changes; holding the
reference is only what makes the map reachable from a click.
A group is the one thing on the map that takes you somewhere when clicked,
and nothing said so. The pointer now changes over one.

Clicking a point no longer moves the map at all. The widget was asked to
zoom to whatever was clicked, which it does by its own reckoning of how
close is close enough — from any nearer than that, clicking a point zoomed
out of the view the reader was already in. Only groups are zoomed to now,
and to the points they stand for rather than to a fixed distance.
Nothing was being marked at all. The widget draws what was clicked a second
time, selected, in a layer of its own — but only for features it built
itself, and it skips the ones it was handed. So the marking never appeared,
and the selected styling the layers carried was never reached.

It is drawn here instead, above every data set, which is also the only place
a point sitting inside an area can be marked and still be seen. Everything
under the click is marked, not just the topmost, so a popup listing several
features says which several.

The popup's rows and its sections have room between them; the values ran
together at the density they were set in.
The marking layer was put on the map the first time something was clicked,
which is while the widget is still working through that same click: it was
left iterating a collection that had changed under it, and the popup never
arrived. The layer is now made once the data it takes its drawing from has
loaded, and the marking itself is left until the widget has finished.

The spacing added to the popup was addressing a part of it that is only
built when a single feature is shown. What a click on several produces is
an accordion, which is what carries the spacing now.
The map cut to the group's points in a third of a second, which is too
quick to follow: what was on screen before and what is on screen after look
unrelated. It now sets off and arrives, slowest at both ends, and takes
longer the further it has to travel — up to a limit, so a jump across the
municipality does not become a wait.
A click on overlapping features marked them all the same, which said that
several things were under the click but not which description belonged to
which. Each marking now has a colour of its own, and the popup's own dot
takes the same one.

Which section gets which colour is worked out from the id it prints rather
than from its position: the popup lists what was clicked in the reverse of
the order it was handed, and that is the widget's business to change.

Two things are left out of the marking. The background map is drawn from
tiles whose features answer a click like any other, and marking a stretch
of road is not what was asked for; and the markings themselves, which would
otherwise be marked again on the next click.
The popup opened over the thing that was clicked, which is the one place it
cannot be read against. It is an overlay of the map's, hung by its bottom
edge from a coordinate, so it now hangs from the northernmost point of what
was clicked and the map keeps it there as the view moves.

The markings reach exactly as far as the map does when it works out what a
click hit, so the popup lists what is marked rather than nearly that: a
wider reach of our own marked features the popup had never heard of.

A lone point far out is drawn from the layer that groups them, which had no
popup of its own, so clicking one said nothing. It has one now.

The markings are drawn in bright colours rather than black. They lie over a
map of greys and greens and over the data sets' own muted reds and blues,
and have to be told from both; thinner, too, so an outline marks a shape
without swallowing it.
@jeppekroghitk
jeppekroghitk force-pushed the feature/8191-extend-test-map-functionality branch from fa9ccb7 to 58de4df Compare September 16, 2026 10:41
The broker ships with a maximum of a thousand entities per request and
answers a larger limit with 403 TooManyResults, so a map that asks for a
layer once drew the first page of a data set that has outgrown it. That
maximum is the broker's own configuration rather than anything NGSI-LD
imposes, so it is raised where it is set instead of paged around here.

What is left is noticing when it falls behind the data again. The read asks
the broker to count, and fails if fewer entities came back than the broker
says it holds, rather than handing on a fraction that looks complete.

The two settings are a pair: APP_BROKER_MAX_RESULTS must stay within
SCORPIO_ENTITY_MAX_LIMIT, or every read is refused outright.
@jeppekroghitk
jeppekroghitk force-pushed the feature/8191-extend-test-map-functionality branch from 58de4df to b9dcfb1 Compare September 16, 2026 10:42
@jeppekroghitk
jeppekroghitk changed the base branch from feature/8191-paginated-datacontroller to develop September 17, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend test-map functionality with layer toggle, information popups, clustering etc.

1 participant