2

I was reading Fastest Way to Find Distance Between Two Lat/Long Points and thought that the solution to this question was a good way to solve a problem of mine. However, I also using django with mysql so when I save a model object, it's saved with the django model types. Of course the solution to that question requires me to use certain functions/object in mysql that django itself doesn't have as a model type. I realize that geodjango has the types, but I don't think I need/want all that extra functionality when I only really need this one solution(i.e. I don't want to install geodjango). So how do I store those mysql geometry datatypes using django model types? Do I have to write some myself or directly inject sql commands? Can someone point me to some sample code? Or perhaps there's a really, really lightweight geodjango that's super easy to install/setup?

Community
  • 1
  • 1
Derek
  • 11,980
  • 26
  • 103
  • 162

1 Answers1

0

Geodjango is part of contrib. if you have django installed, and you have the bindings for spatial data types in mysql, you have geodjango setup, it's really not any harder than that, and now your queries are not only really easy, you get lots more queries available too.

Issac Kelly
  • 6,309
  • 6
  • 43
  • 50
  • Not really. Geodjango installs with Django, but in order to run, it requires a good list of dependencies: https://docs.djangoproject.com/en/1.8/ref/contrib/gis/install/geolibs/. It's pretty much an overkill if one just wants to store a spatial point. – Victor Sergienko Aug 26 '15 at 06:53