Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add basic geometry attributes for custom schema inline expressions #979

Closed
quincylvania opened this issue Aug 14, 2024 · 4 comments · Fixed by #1084
Closed

[FEATURE] Add basic geometry attributes for custom schema inline expressions #979

quincylvania opened this issue Aug 14, 2024 · 4 comments · Fixed by #1084

Comments

@quincylvania
Copy link
Contributor

Is your feature request related to a problem? Please describe.
For OpenTrailMap I'd like to be able to be able to show the trail length. I'd also like to filter parks by size/coverage with MapLibre instead of with min_size in the tiles (gets around our need for #965 too).

Describe the solution you'd like
I'd like to be able to do something like the below. I'm not sure about the best syntax or property names, or if these should be functions instead.

attributes: 
  - key: length
    value: '${ feature.length_km }'
  - key: area
    value: '${ feature.area_km2 }'
  - key: bbox_area
    value: '${ feature.bbox_area_km2 }'
  - key: min_lat
    value: '${ feature.min_lat }'
  - key: min_lon
    value: '${ feature.min_lon }'
  - key: max_lat
    value: '${ feature.max_lat }'
  - key: max_lon
    value: '${ feature.max_lon }'

For point features the area/length would return zero and the min/max lat/lon would just be the feature's lat/lon.

@msbarry
Copy link
Contributor

msbarry commented Aug 17, 2024

OK got it, these should be relatively straightforward to add although I might want to find a way to handle other units (km, miles, feet, acres, hectares, etc.) Also I don't think anything has had to compute exact distances between lat/lon yet so will need to add in that support to the java layer as well.

@quincylvania
Copy link
Contributor Author

I might want to find a way to handle other units (km, miles, feet, acres, hectares, etc.)

This might be helpful. Though in MapLibre you can apply multiplication expressions to attributes before displaying them as labels, so developer can easily apply conversions themselves.

In my proposal I have the default units at km and km2, but they should probably be m and m2 instead to better accommodate more human-sized features.

@msbarry
Copy link
Contributor

msbarry commented Nov 2, 2024

Take a look at #1084 and let me know what you think - it exposes all of the geometry utilities that java profiles have access to to inline expressions so I think it should cover these cases.

@quincylvania
Copy link
Contributor Author

@msbarry Looks perfect for our use case, thanks!

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 a pull request may close this issue.

2 participants