Opened 4 years ago
Last modified 4 years ago
#21525 new enhancement
Boundaries for specific areas inside a country for validation rules
Reported by: | angoca | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core validator | Version: | |
Keywords: | Cc: |
Description
I am creating the validator rules for Colombia. I have a global rule for addresses in Colombia; however, in a specific city the naming used goes against to the regular expression we have for the rest of the country.
Is it possible to have a areaSelector like we have countrySelector?
Something like:
- This rule is for Colombia, except this area/city.
- And this other rule is for Colombia, in this specific area/city.
Attachments (0)
Change History (3)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Addr:city and addr:place will work for features that already include these tags (I suppose). But not to validate the name of a highway, nor the street name of an address that does not include these extra addr tags.
My example is this one: I need to validate the streets name in Colombia, which follows a numbering pattern. More or less is like: They start with a kind of way (carrera, calle, diagonal, transversal) followed by a number; when the way is important it is preceded by the word "Avenida"
To validate the structure, we are using this regular expression:
*["highway" =~ /trunk|primary|secondary|tertiary|residential|link/]["name"]["name" !~ /^((Calle|Avenida Calle|Carrera|Avenida Carrera|Transversal|Avenida Transversal|Diagonal|Avenida Diagonal) [0-9]{1,3}[A-Z]{0,1}( Bis( [A-Z]){0,1}){0,1}( Este| Sur| Oeste| Norte){0,1}|Vía .*)$
Most of the Colombian cities (Bogota, Medellin, Cali) follow this pattern. However, we found that one city (Cúcuta) has other rules, and for that city we need another regular expression. Why don't extend the current regular expression? because the pattern of this city uses the same words in other ways (they use the word "Avenida" instead of "carrera").
So, we need to validate the street names with the given regular expression. But Cucuta, with another one. By using the current rules, false errors are being raised in Cucuta.
I thought something like overpass turbo that specifies the area when the query is performed:
area[name="Colombia"][admin_level=2][boundary=administrative]->.searchColombia; area[name="Cúcuta"][admin_level=6][boundary=administrative]->.searchCity; ( way["highway"~"trunk|primary|secondary|tertiary|residential|link"]["name"]["name" !~ "^((Calle|Avenida|Transversal|Diagonal) [0-9]{1,3}[A-Z]{0,1}( Bis( [A-Z]){0,1}){0,1}( Este| Sur| Oeste| Norte){0,1}|Vía .*)$"](area.searchColombia)(area.searchCity); );
comment:3 by , 4 years ago
This is a thing we also could use. In South Tyrol we have the rule that all names are bilingual German / Italian. In municipalities with a German-speaking majority the German name goes first else the Italian name.
There ought to be a function to read a user-supplied GeoJSON file and an "inside" test for the features in that file. That would keep the default territories file as is, and allow everybody to define their own areas with as good precision as they want.
The national boundaries are already simplified and still quite big. Therefore, I doubt that we will include lower levels in near future.
We need to find a different solution.
Does it not work if you filter by
addr:city
oraddr:place
with some specific values?Please, share some examples and/or demo code, what you have in mind. Thanks