<p>This will depend on what you're actually trying to do, but if you're building this as part of a plugin, I'd store them as relational tables in the database, and display them as dropdown fields. If you provide more specific information about what you're building, I'll see if I can lend a hand.</p>

CC BY-SA 3.0
2015-09-24T07:27:13.447Z
Thanks Taylor. It will be a directory of sea ports. So I am planning geocoding, maps and a url structure like 'country/city/portname'. I was also keen on exploring the element API Brandon [https://github.com/pixelandtonic/ElementAPI] to provide json ouput. It might be an ambitious first craft project but I am keen to dig in :)
joomkit
CC BY-SA 3.0
2015-09-24T13:18:48.140Z
If it were me, I'd just setup a [Route](http://buildwithcraft.com/docs/routing) that sends that URL to your template, then fetch related content with Craft's native entry functionality. And the ElementAPI is a fantastic (if a little ambitious) way to get into Craft!
Taylor Daughtry
CC BY-SA 3.0
2015-09-29T13:42:32.897Z
A plugin sounds like overkill for a flexible CMS surely?
joomkit
CC BY-SA 3.0
2015-09-30T15:01:30.870Z
@joomkit Correct, from what you described in your previous comment I'd suggest simply using Routes, as I mentioned. (Routes are native Craft functionality.) Not sure about any other needs you might have, so YMMV.
Taylor Daughtry
CC BY-SA 3.0
2015-09-23T15:48:31.280Z
2015-09-23T15:48:31.280Z
Taylor Daughtry
<p>Is there a recommended way for storing countries and cities in craft?
I can see fields and categories as obvious options but its difficult to see the disadvantages/advantages of either at the beginning of a project.</p>

<categories>
Best practice way to store countries and cities
# Best practice way to store countries and cities

(Asked by: username_0 on 2015-09-23)

Is there a recommended way for storing countries and cities in craft?
I can see fields and categories as obvious options but its difficult to see the disadvantages/advantages of either at the beginning of a project.

**Tags:** categories

---

## 1 answers

### Answer by username_1 on 2015-09-23. Score: 2

This will depend on what you're actually trying to do, but if you're building this as part of a plugin, I'd store them as relational tables in the database, and display them as dropdown fields. If you provide more specific information about what you're building, I'll see if I can lend a hand.

> **Comments:**
> **username_0**: Thanks Taylor. It will be a directory of sea ports. So I am planning geocoding, maps and a url structure like 'country/city/portname'. I was also keen on exploring the element API Brandon [https://github.com/pixelandtonic/ElementAPI] to provide json ouput. It might be an ambitious first craft project but I am keen to dig in :)  
> **username_1**: If it were me, I'd just setup a [Route](http://buildwithcraft.com/docs/routing) that sends that URL to your template, then fetch related content with Craft's native entry functionality. And the ElementAPI is a fantastic (if a little ambitious) way to get into Craft!  
> **username_0**: A plugin sounds like overkill for a flexible CMS surely?  
> **username_1**: @joomkit Correct, from what you described in your previous comment I'd suggest simply using Routes, as I mentioned. (Routes are native Craft functionality.) Not sure about any other needs you might have, so YMMV.  

---

