So…i have used a map in a project which needs coordinates to set markers to different positions. There are many options available to me to get the coordinates.
-
Store the coordinates in a database and use django view to get and forward the coordinates to the javascript function using an ajax response.
-
Store it into a python list or dictionary and send the data when needed to that javascript func.
-
Hard code the coordinates in a HTML tag attribute and get them via javascript and then set the marker.
-
Use files and get data through file I/O in django view and forward that to the javascript function.
I want to know which of these techniques is efficient for about 50 set of coordinates and which one will be more sufficient if my set increases to about 1000?
If you have a better way to do this…please share it..
Thanks
I think the best way would be to store this data in a database, for a couple of reasons:
If for some reason you don’t want to use any database (even though you can always store this data in a file with sqlite) you can also try storing it in some python object and then send them to js (so the second option), and the third one I think is the worst – you are not able to make any operation with this data outside javascript, it would be very hard to read or debug (syntax errors for example).
Hth