Actions5
Get Cities by State
AI-generatedOverview
This node retrieves geographical information related to countries, states, and cities based on specified ISO codes. Specifically, the 'Get Cities by State' operation fetches all cities within a given state or province, identified by the country's ISO 3166-1 alpha-2 code and the state's ISO code. This is useful for applications requiring detailed location data, such as travel planning, logistics, or demographic analysis.
Use Case Examples
- Fetch all cities in California, USA by providing 'US' as the country code and 'CA' as the state code.
- Retrieve cities in São Paulo, Brazil using 'BR' for the country code and 'SP' for the state code.
Properties
| Name | Meaning |
|---|---|
| Country Code | ISO 3166-1 alpha-2 country code (2 letters) used to specify the country for which cities are to be retrieved. |
| State Code | State or province ISO code used to specify the state within the country for which cities are to be retrieved. |
Output
JSON
jsondata- Array of city objects representing all cities within the specified state.
Dependencies
- country-state-city library for geographical data
Troubleshooting
- Ensure the country code is a valid ISO 3166-1 alpha-2 code; invalid codes will result in no data or errors.
- State code must be accurate and correspond to the specified country; incorrect codes may return empty results.
- If using ISO3 country codes in other operations, ensure they are correctly mapped to ISO2 codes to avoid errors.
Links
- country-state-city NPM Package - Library used to fetch country, state, and city data.