I want to store a bunch of lines/paths
in a database (using Django), where each line has a title or other info in the table, along with a list of (x,y)
coordinates. What is the best way to store these coordinates? It seems like a ManyToManyField
is not fitting, and things like CharFields
are a waste of space and processing. How do I add a list of points in the form [[x1,y1],[x2,y2],...]
to the database or get it back out?
Asked
Active
Viewed 931 times
3

user
- 9
- 4

roboguy222
- 157
- 13
-
possible duplicate of [How to create list field in django](http://stackoverflow.com/questions/5216162/how-to-create-list-field-in-django) – Mathieu Marques Aug 21 '13 at 19:41
-
the ListField does not support complex types (lists), so this is not a duplicate – roboguy222 Aug 21 '13 at 19:55
-
You want to store coordinates. No need for lists, tuples will do. – Mathieu Marques Aug 21 '13 at 19:56
-
I assumed a tuple was a complex type, since it is very nearly a list. Not true? – roboguy222 Aug 21 '13 at 20:03
-
My english is nowhere near good enough to explain you the difference :/. Instead, see [this answer](http://stackoverflow.com/a/626871/1824222). Basically think of tuples as structuring thingies, and lists as objects with methods and stuff. – Mathieu Marques Aug 21 '13 at 20:12