Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Getting possible geom type map #1143

hyperknot started this conversation in General
Jan 7, 2025 · 1 comments · 3 replies
Discussion options

Hi, is there a way to generate a JSON or even just a text file of the possible geom types for each layer for a given schema, like OMT?

For example:
park -> ["Polygon"]
water -> ["Polygon"]
... -> ["MultiPolygon"]

I was thinking of parsing a full planet mbtiles for this, but planetiler needs to have this information inside, I guess. Or does it depend on the OSM dump?

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

There's no out-of-the-box way to do this now, although it would be relatively straightforward to add this to LayerAttrStats in addition to the properties types by layer that it already tracks. We could pass it through as a non-standard extra field in mbtiles metadata vector_layers. The expanded tilestats json field uses the geostats format which has a "geometry" field, but that only allows for a single geometry type 🙁

You must be logged in to vote
3 replies
Comment options

I guess we can insert a new key in geostats, can we not? Does it actively say that it's not allowed?

To explain why this would be great, is that right now there is a big problem with MapLibre shipping v5.0.0 breaking backwards compatibility on geom types (details are in Slack). Hence we have to update all the existing stylesheets, and at that point we could greatly simplify them by removing the geom type filter from many, if not most of them.

Comment options

Yeah I don't see any downside to tracking this in LayerAttrStats and outputting in vector_layers, we could hide it behind a command-line flag if we're concerned about the extra key. It would look something like this:

 {
 "vector_layers": [
 {
 "id": "tl_2016_us_county",
 "description": "Census counties",
+ "geometries": ["Polygon"]
 "minzoom": 0,
 "maxzoom": 5,
 "fields": {
 "ALAND": "Number",
 "AWATER": "Number",
 "GEOID": "String",
 "MTFCC": "String",
 "NAME": "String"
 }
 },
 {
 "id": "tl_2016_us_primaryroads",
 "description": "Census primary roads",
+ "geometries": ["LineString", "MultiLineString"]
 "minzoom": 0,
 "maxzoom": 5,
 "fields": {
 "FULLNAME": "String",
 "LINEARID": "String",
 "MTFCC": "String",
 "RTTYP": "String"
 }
 }
 ]
 }
Comment options

This sounds great!

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

AltStyle によって変換されたページ (->オリジナル) /