Skip to content

feature: measure tool for measuring existing objects - #2277

Open
02JanDal wants to merge 1 commit into
origo-map:masterfrom
02JanDal:feature/measure-existing
Open

feature: measure tool for measuring existing objects#2277
02JanDal wants to merge 1 commit into
origo-map:masterfrom
02JanDal:feature/measure-existing

Conversation

@02JanDal

Copy link
Copy Markdown
Screencast.From.2026-01-30.23-23-58.online-video-cutter.com.mp4

Closes: #2276

Not super happy about the icon, but couldn't find anything better either.

@Grammostola

Grammostola commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

I tested this with a Geoserver 2.28.1 instance.

  • If using WMS layers from postgresql views geoserver assigns random feature ids upon getfeatureinfo request which means multiple measure actions can be taken on a single polygon or line, this results in an increasingly visible style change. This may be an issue with not having configured Geoserver for stable keys for such layers however, but it might be worth documenting for the tool.

  • If using WMS layers with infoFormat set to something other than application/json (default) then the getfeatureinfo that this tool sends in order to get a stable ID and geometry back will probably not result in that, so the tool should probably always issue getfeatureinfo requests with infoFormat application/json (at least for Geoserver. Maybe check the server "type" of the source)

  • I note that only geometry types line and polygon are accepted. Would it be a smoother user experience if multiLine and multiPolygon were accepted as well?

@steff-o

steff-o commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Tested with GeoServer and it works like expected, but:

  • I agree with @Grammostola that MultiLine and MultiPolygon should be supported. In origo it is not common to create multiparts, but it is possible (with just one ring) and external sources could very well be multiparts. It requires some additional fixing of the old code, but not much. No sure if measure should just explode multiparts and label each sub part or label just the aggregate. Both is better that just ignoring them. Labling both would probably look messy.
  • I don't think the stable key issue is an issue. It requires the user to click the same feature multiple times and can easily be cleared. The same problem could also arise in WFS layers if using BBOX without stable keys, which would load the same feature for each new extent. It is just bad practice to not have stable keys.
  • The icon should be changed. The current looks like a color picker. I suggest using just a plain old arrow from material:
image
  • The featureInfo tool has an option to change the mouse pointer if there is something to click where the pointer is. That would be cool if that could be reused, but not necessary if it means duplication the code.

@02JanDal
02JanDal force-pushed the feature/measure-existing branch from 03a884c to a44025b Compare February 23, 2026 20:01
@02JanDal
02JanDal force-pushed the feature/measure-existing branch from a44025b to 5131432 Compare February 23, 2026 20:13
@02JanDal

Copy link
Copy Markdown
Author

Added support for multilines- and polygons, force using application/geo+json (should work with most servers, unless they only support GML or similar), fixed a small bug and changed the icon to left_click_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24

Stable IDs: I don't think there's a lot I can reasonably do here sadly, other than storing the entire feature including attributes and geometry and compare it

Different pointer on hover actually already works using the functionality from featureinfo.

@steff-o

steff-o commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Tested everything OK except the geojson part as a don't understand the problem. @Grammostola can you have a look.

Also, there are some silly linting errors. Seems like linting is not performed on check in until someone has approved it.

@Grammostola

Copy link
Copy Markdown
Contributor

WMS layers configured with infoFormat: text/html can now be measured with this addition.
It first attempts "application/geo+json" which Geoserver isn't likely to understand, maybe measure could take a hint from the "type" prop of configured sources. After that attempt however it employs an understood request ('application/json').

If the measure tool is disabled after having been employed with the new function as in the scenario mentioned, getfeatureinfo works different on these WMS layer after. The "text/html" info_format is forgotten and application/json employed which results in a different featureinfo reply.

And yep org members need to approve workflows to run on third party prs. We can tweak that setting (somewhat) if we wish. The linting rules come with the repo anyway.

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.

Add a measure subtool to measure existing objects

3 participants