zlant / parking-lanes

Parking lanes viewer from OpenStreetMap
https://zlant.github.io/parking-lanes/
MIT License
78 stars 13 forks source link

Use country coder package to switch preset section #56

Open tordans opened 2 years ago

tordans commented 2 years ago

I suggest adding a PR that uses https://github.com/ideditor/country-coder to change the preset section based on the lat/lng.

The way I expect this to work is

For the files, it might be enough to have multiple files of https://github.com/zlant/parking-lanes/blob/master/src/parking/controls/editor/presets.ts and only import the right one(?) – or we keep them in one file like @jakecoppinger did in https://github.com/jakecoppinger/open-parking-map/blob/master/src/parking/controls/editor/presets.ts. However, I feel like adding some hierarchy (instead of a country-"category") will make it easier to maintain.

@zlant @jakecoppinger let me know what you think. Is this a good way to go? Would PR be welcome? Help is welcome :).


Outlook: Another think that could use this country coder feature is, having custom map layers per country. I find using the best areal images available in a region very helpful.

jakecoppinger commented 2 years ago

Sounds great! If you PRed into parking-lanes I'd merge into https://github.com/jakecoppinger/open-parking-map and overwrite my country picker. As usual I'm keen to merge any improvements I make here too.

Another concern is some bugs I've noticed around the textfields of the values on the right hand side - if you swap to a preset which doesn't have an empty value string for a given key, then the textbox isn't cleared.

For example, if you have a no parking preset which doesn't specify time intervals, unless you have a key value pair with the value being an empty string, the textbox isn't cleared.

if no preset is found, the section that shows the presets does show a gray message similar to "no preset for found, learn more at https://github.com/zlant/parking-lanes/README.md#presets"

I love this idea, especially if it encouraged contributions.

(ideally that would be persisted as an URL parameter as well, so it's shareable)

I don't understand why this would be preferable - what if you sent a link to somebody in a different country?

zlant commented 2 years ago

Great idea! I like.

multiple files or we keep them in one file like

I think one file will be enough.

if no preset is found, the section that shows the presets does show a gray message similar to "no preset for found, learn more at

I think need show default presets: no parking, no stopping, free and paid parking