Is GeoDjango the right choice for this?

221 views
Skip to first unread message

- -

unread,
Jan 11, 2013, 9:13:25 AM1/11/13
to geod...@googlegroups.com
Hello there,

my plan is to create a website where I can draw points and polygons on a map like Google Maps, Bing Maps or Open Street Maps. The points and polygons are custom locations and custom regions, represented by Django models.

- When I create a new location, I want to check in what region the location is.
- I want to provide locations close to a user-specified point (search function)-
- I want to display a map, query all regions and locations based on the displayed sector and draw them on the map.

I started reading through GeoDjango, but the more I read, the less I understand. Is GeoDjango actually the right choice for me?

Thanks.

Jeffrey Johnson

unread,
Jan 11, 2013, 10:51:38 AM1/11/13
to geod...@googlegroups.com
Short answer is yes. What specific GeoDjango questions do you have or what dont you understand. I think we can all help a bit more if we understand that.

Jeff

--
You received this message because you are subscribed to the Google Groups "geodjango" group.
To post to this group, send email to geod...@googlegroups.com.
To unsubscribe from this group, send email to geodjango+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/geodjango?hl=en.

psaod...@gmail.com

unread,
Jan 12, 2013, 10:32:26 AM1/12/13
to geod...@googlegroups.com
Thanks for your answer.

I am really new to geo programming (or whatever you call it). I have certain ideas about the whole process of working with geo information. For example I think a point on a map is defined by latitude and longitude, and that an area is defined by several points.

As far as I understand PostGIS is an addon to PostgreSQL that is able to do all the math inside the database. And GeoDjango is an Django App, that does keep away most of the math stuff from me, by doing something like: distance = my_position.distance_to(destination); print destination.convert('km');

So I start reading the Tutorial and it explains nicely how to setup PostgreSQL, PostGIS.

The thing that confuses me terribly is: I have no idea what all that other stuff is, that is explained here: https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#

Why do I need world borders? What does ogrinfo do for me? What's that GDAL interface? etc etc. Basically all the tutorial after "Setting Up" (https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#setting-up) is absolutely confusing to me.

Honestly, I was expecting something like this in the beginning:
1. "Create a model 'Point of Interest'"
2. "Get the distance between two point of interests"
3. "Create a route with several waypoints and get its total length"
4. "Create a region"
5. "Get all points in a region"

You know, something easy. Instead I get thrown into something I do not understand at all. :(

I don't even know where to start. But the tutorial is definitely not the place :(

Tomas Neme

unread,
Jan 12, 2013, 11:40:40 AM1/12/13
to geod...@googlegroups.com
Well, it's not all as simple as that, I don't remember the details,
it's been about a year since I last touched GeoDjango stuff, but the
base assumption you're making that is wrong is that "a point is
defined by latitude and longitude".

I reality, there's a LOT of different projection systems to match the
real world with a map. The latitude-longitude system (which has a code
that I don't remember) is the most accurate one, but also the most
expensive, because it implies spherical calculations, so the distance
between two points is not just sqrt((a-b).x**2 + (a-b).y**2) since
it's a 3D spherical surface.

The solution for this performance issue is to generate a bazillion
different projection systems each of which work well with a particular
area of the world. NYC has it's "optimal" projection, and Buenos Aires
has another. There's a different one that averages best on
country-scale level for the US, and another one for brazil, get the
idea?

So one of your first choices should be your projection system. postgis
supports all of them (they can be loaded).

And conversion between system is one of the points where GDAL comes
into play. Some if it's utilities are used for conversion between
different systems.

Likewise, there're are other operations that the utilities you mention
help with: intersection, substraction, addition between two areas must
return an area. Containment, area vs point, distance between two
areas, etcetera. All these are complicated operations that all the
toolset help you achieve. I don't remember the details, as I said, but
the documentation should help you
> To view this discussion on the web visit
> https://groups.google.com/d/msg/geodjango/-/nJ1zYjAfcTMJ.
>
> To post to this group, send email to geod...@googlegroups.com.
> To unsubscribe from this group, send email to
> geodjango+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/geodjango?hl=en.



--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

jpk

unread,
Jan 12, 2013, 12:53:05 PM1/12/13
to geod...@googlegroups.com
On Sat, Jan 12, 2013 at 10:32 AM, <psaod...@gmail.com> wrote:
Thanks for your answer.

I am really new to geo programming (or whatever you call it). I have certain ideas about the whole process of working with geo information. For example I think a point on a map is defined by latitude and longitude, and that an area is defined by several points.

As far as I understand PostGIS is an addon to PostgreSQL that is able to do all the math inside the database. And GeoDjango is an Django App, that does keep away most of the math stuff from me, by doing something like: distance = my_position.distance_to(destination); print destination.convert('km');

So I start reading the Tutorial and it explains nicely how to setup PostgreSQL, PostGIS.

The thing that confuses me terribly is: I have no idea what all that other stuff is, that is explained here: https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#

Why do I need world borders?

Your application, specifically, may not need them.  That's fine.  The world borders in the tutorial serve as some external data you can load into the database so you have something to work with while learning how to query and manipulate GeoDjango models/fields. In your case, your data might all be authored in the application you will write, so you won't have to load external data like in the tutorial.  But for the purposes of the tutorial, you should follow the instructions so you can complete the rest of the tutorial.
 
What does ogrinfo do for me?

From the tutorial: "The GDAL ogrinfo utility allows examining the metadata of shapefiles or other vector data sources".  It then goes on to give an example of its use.  Then it shows how to write a model class based on what ogrinfo told you about the data.  

Again, the concept of loading external data in might not matter much to you when you write your app, but it's necessary for getting this data into your database so you can do the rest of the tutorial.  But this part is useful to you because it's an example of writing a model with spatial fields in it (the fact that it will later hold data you load in from a shapefile or whatever is immaterial).
 
What's that GDAL interface?

The GDAL interface is similar to ogrinfo, but inside GeoDjango.  This is useful if your application needs to handle things like shapefiles dynamically (as opposed to you loading data from a shapefile manually once).  You might do this if you, say, allowed users to upload their own shapefiles for display.  Your app would need to use things covered in the GDAL Interface section to handle them properly. You may not need this functionality, but many GeoDjango users do.  Do it anyway for your enrichment.
 
etc etc. Basically all the tutorial after "Setting Up" (https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#setting-up) is absolutely confusing to me.

Honestly, I was expecting something like this in the beginning:
1. "Create a model 'Point of Interest'"
2. "Get the distance between two point of interests"
3. "Create a route with several waypoints and get its total length"
4. "Create a region"
5. "Get all points in a region"

You know, something easy. Instead I get thrown into something I do not understand at all. :(

I don't even know where to start. But the tutorial is definitely not the place :(

I was in your position a while back.  I didn't know anything about GIS. This tutorial is geared toward someone who knows something about GIS and wants learn to apply that knowledge using GeoDjango.  Which is reasonable because teaching you all you need to know about GIS stuff is outside the scope of the tutorial.  But, for past-me, and present-you, that makes it harder because there's a bunch of stuff in the tutorial that you're not familiar with.  Once you are familiar with it, though, it makes perfect sense.  What I ended up doing is following this tutorial to the letter, and every time I came across a term or concept that wasn't familiar to me, I stopped and googled.  Like, I had no idea what a spatial reference system was so I probably spent half a day googling and reading stuff (lots of which I didn't understand either... so more google) until I finally came back and continued the tutorial.  Rinse and repeat until you're confident you could teach the tutorial to a past-you.  You may not need some of the specific things this tutorial covers in your application, but you'll eventually need the other things you'll learn this way.

Anyway, some things in addition to the tutorial that you'll need:
HTH,
jpk




On Friday, 11 January 2013 16:51:38 UTC+1, ortelius wrote:
Short answer is yes. What specific GeoDjango questions do you have or what dont you understand. I think we can all help a bit more if we understand that.

Jeff

On Fri, Jan 11, 2013 at 6:13 AM, - - <stadtp...@ymail.com> wrote:
Hello there,

my plan is to create a website where I can draw points and polygons on a map like Google Maps, Bing Maps or Open Street Maps. The points and polygons are custom locations and custom regions, represented by Django models.

- When I create a new location, I want to check in what region the location is.
- I want to provide locations close to a user-specified point (search function)-
- I want to display a map, query all regions and locations based on the displayed sector and draw them on the map.

I started reading through GeoDjango, but the more I read, the less I understand. Is GeoDjango actually the right choice for me?

Thanks.

--
You received this message because you are subscribed to the Google Groups "geodjango" group.
To post to this group, send email to geod...@googlegroups.com.
To unsubscribe from this group, send email to geodjango+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/geodjango?hl=en.

--
You received this message because you are subscribed to the Google Groups "geodjango" group.
To view this discussion on the web visit https://groups.google.com/d/msg/geodjango/-/nJ1zYjAfcTMJ.
To post to this group, send email to geod...@googlegroups.com.
To unsubscribe from this group, send email to geodjango+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/geodjango?hl=en.



--
john p. kiffmeyer

psaod...@gmail.com

unread,
Jan 12, 2013, 5:52:43 PM1/12/13
to geod...@googlegroups.com
Hi john,

thanks for your really detailed explanation. I very much appreciate that. I was not aware that all of that is part of the tutorial. I had the feeling they just jumped into the topic somewhere in the middle. You motivated me to go through the tutorial because now I know that it's all part of learning process, and that most of that complicated stuff is only for learning GeoDjango!

Stadtpirat

Max Demars

unread,
Mar 22, 2013, 1:36:55 PM3/22/13
to geod...@googlegroups.com, - -
I know this question was asked a couple weeks ago, but if you are still looking for a tutorial about waypoints, distance and google maps take a look at this one: http://invisibleroads.com/tutorials/geodjango-googlemaps-build.html
Reply all
Reply to author
Forward
0 new messages