I want to store (City, Country) pairs in my models as a field. Is GeoDjango an overkill for my use case?

17 views
Skip to first unread message

John Reese

unread,
Sep 17, 2020, 5:03:06 AM9/17/20
to geodjango
I want to store (City, Country) pairs in my models as a field. I want to do something like this (the location field). I will later preform search on the (City, Country) pairs in my models.

Is GeoDjango an overkill for my use case? If yes, what do you suggest for me to use?

Claude Paroz

unread,
Sep 17, 2020, 8:48:47 AM9/17/20
to geod...@googlegroups.com
Le 17.09.20 à 10:55, John Reese a écrit :
> I want to store (City, Country) pairs in my models as a field. I want to
> do something like this <https://stackoverflow.com/jobs> (the location
> field). I will later preform search on the (City, Country) pairs in my
> models.
>
> *Is GeoDjango an overkill for my use case? If yes, what do you suggest
> for me to use?*
No, it's not overkill. You will need a GIS backend to query with a
"within distance" loookup.

Claude
--
www.2xlibre.net

John Reese

unread,
Sep 17, 2020, 2:09:49 PM9/17/20
to geodjango
Hey Claude,

thank you for responding. I think I may not have expressed my use case in the best way. What I want the user to be able to do is:
  • enter their city and country ((City, Country) pair) upon registration
  • modify their city and country after they have registered
  • search for jobs in a particular (City, Country) pair - I just want to display jobs in that (City, Country) pair, not other jobs
From what I listed above, I don't see the need to do "within distance" loookups, as you have suggested.

What I was aiming at when I linked StackOverflow Jobs was that when you start typing in the name of a city, you have a drop-down list with all the cities in the world that have those characters in their name and I don't know how I would achieve that.

Do you still think I need to use GeoDjango or is there an easier way to cover my use case?

Claude Paroz

unread,
Sep 17, 2020, 2:18:13 PM9/17/20
to geod...@googlegroups.com
Dear John,

I guess your explanation is forming the answer :-) GeoDjango is a Django
extension to help manage geometric objects. As you don't seem to need
those, then no, GeoDjango will not help you.
You will need to find a source with all cities of all countries you are
interested in, but that is not a Django-related issue per se.

Claude

Le 17.09.20 à 17:09, John Reese a écrit :
> Hey Claude,
>
> thank you for responding. I think I may not have expressed my use case
> in the best way. What I want the user to be able to do is:
>
> * enter their city and country ((City, Country) pair) upon registration
> * modify their city and country after they have registered
> * search for jobs in a particular (City, Country) pair - I just want
> to display jobs in that (City, Country) pair, not other jobs
>
> From what I listed above, I don't see the need to do "within distance"
> loookups, as you have suggested.
>
> What I was aiming at when I linked StackOverflow Jobs
> <https://stackoverflow.com/jobs> was that when you start typing in the
> name of a city, you have a drop-down list with all the cities in the
> world that have those characters in their name and I don't know how I
> would achieve that.
>
> *Do you still think I need to use GeoDjango or is there an easier way to
> cover my use case?*
>
> On Thursday, September 17, 2020 at 2:48:47 PM UTC+2 Claude wrote:
>
> Le 17.09.20 à 10:55, John Reese a écrit :
> > I want to store (City, Country) pairs in my models as a field. I
> want to
> > do something like this <https://stackoverflow.com/jobs> (the location
> > field). I will later preform search on the (City, Country) pairs
> in my
> > models.
> >
> > *Is GeoDjango an overkill for my use case? If yes, what do you
> suggest
> > for me to use?*
> No, it's not overkill. You will need a GIS backend to query with a
> "within distance" loookup.
>
> Claude
> --
> www.2xlibre.net <http://www.2xlibre.net>
Reply all
Reply to author
Forward
0 new messages