views:

200

answers:

2

Hi all,

I'm a Geodjango novice and would like to get some help on the following:

I have a MultiPolygonField field, for a GeoDjango application, and would like to display it on my view as cool as it gets displayed on django admin

Say for example I have

def index(request):
    "Index,main view"
    border = WorldBorders.objects.get(name='Italy')
    return render_to_response('world/index.html', {'user': request.user, 'border': border}, context_instance=RequestContext(request)) 

then on world/index.html, what is the way to display the border, as it would be on django admin?

Thanks in advance for all replies!

A: 

http://code.google.com/p/geodjango-basic-apps seems a nice start...

Markos Gogoulos
A: 

I suggest just taking something from http://openlayers.org/dev/examples/ and changing it to suit your needs. Convert the multipolygon field to JSON data, read in the JSON data in javascript (see the OL parser documentation) and display it on the map.

Others may suggest some way of leveraging the django-admin js, but I never found that to be sufficient.

If you have specific questions about any of these steps, just ask another question and hopefully I'll be able to answer.

Conley Owens