2

I am trying to teach my self Django and its spatial extension geoDjango. There is one thing, which is still a bit foggy in my mind. When using the trio: Postgis, geoserver, openlayers is perfectly clear for me how I will display the data on the map. But if geodjango doesn't use geoserver, how do I display the data on the map using Openlayers? Should I export the data as geojson or kml and then use openlayers functions to render them? That would be very limiting.

What's the proper way to do this?

6

It depends on your needs. If you need to display a relatively small number of relatively simple features (such as all locations for shop) then you can eliminate Geoserver and simply use GeoDjango as an ersatz web feature server by serializing data into kml or geojson and serving it to OpenLayers for display, you can also do plenty of CRUD operations easily in GeoDjango.

If you have relatively larger and complex data (such as land parcels or building outlines for a city for example), then you will want the 'proper' WFS features that you get with Geoserver. You can still use GeoDjango to create/query/update/ data in the db, but GeoServer would operate entirely separately from GeoDjango, using data from the same db to fulfill requests coming in from OpenLayers.

For me GeoDjango's biggest strength is being able to use spatial queries with basically the same great ORM syntax as Django, this makes it incredibly easy to write and test complex spatial operations that perform well. The ability to chain queries together is superb. Although you can use it as a simple feature service, it would be difficult to make it perform well under heavy use compared to a purpose-built WFS like Geoserver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.