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

Custom styles for lines #70

Open
C4K3 opened this issue Dec 28, 2024 · 3 comments
Open

Custom styles for lines #70

C4K3 opened this issue Dec 28, 2024 · 3 comments

Comments

@C4K3
Copy link
Contributor

C4K3 commented Dec 28, 2024

Hi, thanks for this library. I've very much enjoyed playing with it. It has just the right amount of complexity to do what I need while still being easy to use.

I have one question/feature request: I'd like to map certain lines (not polygons) but in a different style than what I've configured for streets. Specifically I'd like to draw a waterway=stream which is mapped as a line not a polygon, but I would like it to be blue instead of the color of streets.

If this is already possible then the rest can be ignored, but if not I thought I would ask for thoughts on how this could be implemented.

It seems that the streets landcover class is treated specially. I would like to make it configurable somehow. The easiest solution to implement would be to add a list configuring classes to be treated like streets.

But if we could change the way landcover classes are configured we could remove the special handling for streets and also merge in the width configuration (and possibly styles?) I was thinking something like moving the tags on the landcover classes down one level to allow specifying if they represent an area or line, and then make the lines take a dict with the value being their width. For example:

"streets": {
	"lines": {
		"highway": {
			"motorway": 4,
			"trunk": 4,
			"primary": 3.5,
			"secondary": 3,
			"tertiary": 2.5,
			"cycleway": 2.5,
			"residential": 2,
			"service": 1.5,
			"unclassified": 1.5,
			"footway": 0.7,
			"motorway_link": 3,
		},
		"railway": 2, # Width for all railway tags
		"waterway": False, # Do not draw any waterways (True maps with some default width?)
	}
},
# Map both areas and lines using the same water style
"water": {
	"areas": {
		"natural": ["water", "bay"],
		"place": ["sea"],
		"leisure": ["swimming_pool"],
	}
	"lines": {
		"waterway": {
			"stream": 1,
		}
	}
}

Additional ideas/thoughts:

  • Maybe landcover class would not be an appropriate name anymore, perhaps simply call it a layer?
  • Perhaps later the styles configuration could be put into this as well
  • Perhaps later add some way of representing points as well
  • For lines allow True and False as well for consistency, drawing all values of the given tag with a default width?
  • For lines allow area-style lists of tag values as well for consistency, in which case they get drawn with a default width?

If we could roughly agree on a way to configure this I'd be happy to attempt implementing it. There are an infinite ways this could be configured and this is just one idea, I'm very much open to any other ideas as well.

@chrieke
Copy link
Owner

chrieke commented Dec 28, 2024

No opinion or thoughts on this yet, but nice issue description!

Adding @Shrinks99 comment from another closed issue here as I think there is a partial overlap, he asks for customizable street geometries.

I am also using this library to create some custom styled maps and have run into similar issues when defining street styling as they're all defined under STREETS_WIDTH which is hardcoded in set_geometries.

@Shrinks99
Copy link
Contributor

@chrieke Thanks! Yes, this issue fully overlaps with my thoughts in #60.

Everything in the above example makes sense to me, as long as users are able to pull any arbitrary key value pair from OSM and style it however they choose, I'm a happy camper! Integrating this into a single nested dictionary would be great :)

@ricor07
Copy link

ricor07 commented Dec 28, 2024

Hello, I'd like to work on the project by fixing this issue. Can you assign this to me? 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

No branches or pull requests

4 participants