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

France's cities not matching its states code #685

Closed
romain-sen opened this issue Sep 6, 2023 · 5 comments
Closed

France's cities not matching its states code #685

romain-sen opened this issue Sep 6, 2023 · 5 comments

Comments

@romain-sen
Copy link

You cannot find the cities of Paris for instance because when you select Paris, you get the state code of '75C' but the cities have the state code 'IDF' for 'Ile-de-France'.

@romain-sen romain-sen changed the title France cities not matching States France's cities not matching its states code Sep 6, 2023
@romain-sen
Copy link
Author

Seeing the states data here :
https://github.com/dr5hn/countries-states-cities-database/blob/master/csv/states.csv

The cities match with the states of type : "metropolitan region", but all the other states (state in these region) have no cities matching.

A quick fix would have been to filter the state to only get the "metropolitan region" ones with their matching cities, but we don't have access to the type in the code...

The complete fix : make the cities match with the region and with the other state.

@scramatte
Copy link

+1 here

@dr5hn
Copy link
Owner

dr5hn commented Mar 4, 2024

@dosubot Please help me fix this and raise a PR.

Copy link

dosubot bot commented Mar 4, 2024

I understand the issue you're facing with the mismatch of state codes for cities in France. This seems to be a known issue as there's an open issue titled France No link between city and state databases which was last updated on December 17, 2023.

To resolve this, you would need to update the state codes in your database to match the actual regions or departments. Here's a general approach to update the state codes for France, specifically for Paris to match 'IDF' for 'Ile-de-France':

  1. Identify the Correct Structure for France: Ensure your XML structure accommodates country, state (or region), and city levels. France uses regions and departments, where 'Ile-de-France' is a region and 'Paris' is both a city and a department within this region.

  2. Update or Add the Correct Entries: Look for or add an entry for 'Ile-de-France' and ensure Paris is correctly listed under it with the right state code. If '75C' is an incorrect code and you want to use 'IDF' for 'Ile-de-France', you would update the state code accordingly.

  3. Sample XML Update for Paris in Ile-de-France:
    Assuming your XML structure supports regions and cities, you might add or update entries similar to the following:

<state>
    <id>XXXX</id>
    <name>Ile-de-France</name>
    <country_id>FR</country_id> <!-- Assuming 'FR' is the country code for France -->
    <country_code>FR</country_code>
    <country_name>France</country_name>
    <state_code>IDF</state_code>
    <type>Region</type>
    <!-- Add latitude and longitude if needed -->
</state>
<city>
    <id>YYYY</id>
    <name>Paris</name>
    <state_id>XXXX</state_id> <!-- Match the ID of Ile-de-France -->
    <state_code>IDF</state_code>
    <country_id>FR</country_id>
    <country_code>FR</country_code>
    <country_name>France</country_name>
    <!-- Add latitude and longitude if needed -->
</city>
  1. Adjust According to Your Schema: The above is a simplified example. Your actual implementation may require adjustments based on your schema, especially if you have separate elements or attributes for regions, departments, and cities.

  2. Automate the Update Process: If you have many entries to update, consider writing a script to automate the process. This script would parse your XML, find entries that need updating (e.g., cities in France with incorrect state codes), and update them accordingly.

Remember, the key steps are identifying the correct structure for your data, ensuring the entries for France's regions and cities are accurate, and then updating the state codes to reflect the actual administrative divisions.

As for the structure of the database, the countries table includes fields for various attributes of countries such as id, name, iso3, iso2, phonecode, capital, currency, and more. The countries are linked to regions and subregions through the region_id and subregion_id fields, respectively. These fields are foreign keys that reference the id field in the regions and subregions tables. This setup allows for a hierarchical structure where countries are associated with their respective regions and subregions.

I hope this helps! If you need further assistance, feel free to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dr5hn
Copy link
Owner

dr5hn commented Sep 5, 2024

Duplicate of #473

@dr5hn dr5hn marked this as a duplicate of #473 Sep 5, 2024
@dr5hn dr5hn closed this as completed Sep 5, 2024
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

3 participants