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

Removal of unneeded dispute lua and additional country support #2068

Merged
merged 18 commits into from
May 3, 2022

Conversation

jeffdefacto
Copy link
Contributor

@jeffdefacto jeffdefacto commented Apr 20, 2022

This pulls out some of the lua changes for specific disputes that are no longer necessary as we are not displaying them at this time.

Additionally, 25 dependencies were missing from the map due to a lack of place tag and/or a value of place that is not country. These lua additions change these place nodes to place=country when matching the dependency's iso code.

Lastly, ne_id and ne:brk_id_a3 tags will get pushed to dispute ways to aid in creating a dispute_id.

@jeffdefacto jeffdefacto marked this pull request as ready for review April 20, 2022 19:15
@tgrigsby-sc
Copy link
Contributor

this all makes sense to me, but I can't vouch for completeness, so I'm going to lean on @nvkelso for a proper review

osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Outdated
end
-- French Guiana
if object.tags.place == 'state' and object.tags['ISO3166-1'] == 'GF' then
output_hstore['place'] = 'country'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an odd one, it's an overseas region of France (like Alaska and Hawaii), but also gets it's own ISO code.

My preference is to be true to the data and mark it place = region... and if you want to add POV overrides for ISO and all the other countries we're tracking to be country then that's OK.

The full set are (src):

  • French Guiana
  • Guadeloupe
  • Martinique
  • Mayotte
  • Réunion

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed them to region

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(We keep bouncing back and forth on this one... I left new comments farther down.)

osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Show resolved Hide resolved
osm2pgsql.lua Outdated Show resolved Hide resolved
Copy link
Member

@nvkelso nvkelso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see one last round of comment about French overseas regions.

osm2pgsql.lua Outdated
if object.tags.place and object.tags.wikidata == 'Q23681' then
output_hstore['place'] = 'country'
output_hstore['place'] = 'region'
output_hstore['disputed_by'] = 'CN;RU;IN;GR;CY'
end
-- Turn off Abkhazia label for most countries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update comment:

-- Show Abkhazia label as region for more countries

osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Outdated Show resolved Hide resolved
osm2pgsql.lua Outdated
end
-- Turn off South Ossetia label for most countries
-- Show South Ossetia label as region for most countries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Match comment to what code does:

-- Hide South Ossetia label for most countries

output_hstore['place:US'] = 'region'
output_hstore['place:VN'] = 'region'
output_hstore['place'] = 'unrecognized'
output_hstore['place:RU'] = 'country'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rounding problems, is a map unit more like region or country?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine to do this way for now, but we should revisit once we add kind_detail for these.

output_hstore['place'] = 'country'
end
-- Heard Island and McDonald Islands
if object.tags.place == 'territory' and object.tags['ISO3166-1'] == 'HM' then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a new one to me

osm2pgsql.lua Outdated
-- Recast various French overseas departments as region
-- Réunion
if object.tags.place == 'state' and object.tags['ISO3166-1'] == 'RE' then
output_hstore['place'] = 'region'
Copy link
Member

@nvkelso nvkelso Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in no label drawn a particular style, unless you also add the some/full set of place:XX codes as country (or you set the min_zoom value to be better than 3.7). This is also because they aren't listed in the NE country table (only map unit tables).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EG:

output_hstore['place:AR'] = 'country'
output_hstore['place:BD'] = 'country'
output_hstore['place:BR'] = 'country'
output_hstore['place:CN'] = 'country'
output_hstore['place:DE'] = 'country'
output_hstore['place:EG'] = 'country'
output_hstore['place:GB'] = 'country'
output_hstore['place:GR'] = 'country'
output_hstore['place:ID'] = 'country'
output_hstore['place:IL'] = 'country'
output_hstore['place:IN'] = 'country'
output_hstore['place:IT'] = 'country'
output_hstore['place:JP'] = 'country'
output_hstore['place:KO'] = 'country'
output_hstore['place:MA'] = 'country'
output_hstore['place:NL'] = 'country'
output_hstore['place:NP'] = 'country'
output_hstore['place:PK'] = 'country'
output_hstore['place:PL'] = 'country'
output_hstore['place:PS'] = 'country'
output_hstore['place:PT'] = 'country'
output_hstore['place:RU'] = 'country'
output_hstore['place:SA'] = 'country'
output_hstore['place:SE'] = 'country'
output_hstore['place:TR'] = 'country'
output_hstore['place:TW'] = 'country'
output_hstore['place:UA'] = 'country'
output_hstore['place:VN'] = 'country'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's still do this now...

It's also related to work in #2077.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's continue this in #2077... and reset to "place" = "country" here and for all 5.

osm2pgsql.lua Outdated
end
-- Martinique
if object.tags.place == 'state' and object.tags['ISO3166-1'] == 'MQ' then
output_hstore['place'] = 'region'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

osm2pgsql.lua Outdated
end
-- Mayotte
if object.tags.place == 'state' and object.tags['ISO3166-1'] == 'YT' then
output_hstore['place'] = 'region'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

osm2pgsql.lua Outdated
end
-- Guadeloupe
if object.tags.place == 'state' and object.tags['ISO3166-1'] == 'GP' then
output_hstore['place'] = 'region'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

osm2pgsql.lua Outdated
end
-- French Guiana
if object.tags.place == 'state' and object.tags['ISO3166-1'] == 'GF' then
output_hstore['place'] = 'region'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

yaml/places.yaml Outdated
@@ -176,6 +176,18 @@ filters:
kind: region
kind_detail: province
table: osm
- filter: {name: true, place: unrecognized}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering consolidating this into the existing section above

- filter: {name: true, place: country}

As

- filter: {name: true, place: [country,unrecognized]}

With

  kind: unrecognized

Changing to

 kind: {col: place}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Around line 141

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. even simpler

osm2pgsql.lua Outdated
end
-- New Caledonia
if object.tags.place == 'archipelago' and object.tags['ISO3166-1'] == 'NF' then
output_hstore['place'] = 'region'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Caledonia should be country as it's a dependency of France

Copy link
Member

@nvkelso nvkelso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-- Turn off Kosovo country label for CN;RU;IN;GR

Also add here NP, BR, PS, MA, AR, VN, ID, UA

-- Hide Kosovo region labels for several POVs including China and Russia

Also add here NP, BR, PS, MA, AR, VN, ID, UA

osm2pgsql.lua Outdated
output_hstore['place:UA'] = 'region'
output_hstore['place:VN'] = 'region'
output_hstore['place'] = 'unrecognized'
output_hstore['place:RU'] = 'country'
end
-- Turn off Nagorno-Karabakh label for most countries
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Change the name here to Artsakh (Nagorno-Karabakh) as that's the new name but not in common circulation so still put the old name in the parenthetical.

Copy link
Member

@nvkelso nvkelso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@jeffdefacto
Copy link
Contributor Author

@nvkelso I believe all the comments have been addressed now.

Copy link
Member

@nvkelso nvkelso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@jeffdefacto jeffdefacto merged commit 66740a3 into master May 3, 2022
@jeffdefacto jeffdefacto deleted the additional_country_support branch May 3, 2022 21:44
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 this pull request may close these issues.

3 participants