On Tue, Nov 23, 2010 at 8:35 PM, Charlie DeTar <cha
...@gmail.com> wrote:
> On 11/21/2010 06:26 PM, Bruno Renié wrote:
>> I've made a few improvements since my previous email. The
>> GeoModelAdmin admin class is back since it makes the customization of
>> the admin much simpler (OSMGeoAdmin is still here too). It also
>> removes the need to deprecate it while existing application may still
>> use the get_map_widget() hack.
>> I also wrote some documentation for the forms library:
>> https://github.com/brutasse/django/blob/5472-map-widgets/docs/ref/con...
Hi Charlie, thanks for joining the discussion!
> Thanks for working on this stuff! I'm the author of olwidget and just
> wanted to throw my 2c in. I totally support the work you're doing, and
> don't currently have time to contribute too much.
> I'll just point out some of the biggest areas of difficulty that I've
> faced with olwidget:
> 1. The quality of the out-of-the-box openlayers editing leaves a bit to
> be desired (I haven't explored the google maps alternatives much). Some
> basic usability stuff like undo and redo are missing; and the toolbar
> buttons aren't very obvious or accessible. It's totally non-functional
> on touchscreen devices that lack "drag". I don't think olwidget solved
> this super well, but I think it did go a few clicks beyond the vanilla
> OL way (at least it's got undo and redo).
> 2. When maps enter user-space, it becomes especially critical that they
> have a high degree of customizability. Things like colors, icons, base
> layer choices, etc. can be both usability issues and political
> statements. But that customizability can present a lot of complexity
> and duplication in the Django implementation, as Django is operating as
> a proxy to javascript. I'm not sure where the best balance is, but it
> would be nice to figure out some way to allow the complexity to be
> implemented in javascript directly, to avoid having too many layers of
> gloves between the developer and the map.
Indeed, that's an area that could be improved quite a lot. The big
advantage of having a template-based map widget is that you can extend
and override different blocks but a lot of work needs to be done to
identify the areas that would need to be customized in the base
template. Right now you can easily add some code *after* all the
rendering is done but regarding the parameters needed to instantiate
the map (projection, default values, colors, layers, controls…), I
can't find an obvious way to specify those parameters in the template
without requiring the end developer to rewrite the whole thing.
Ideally it would be awesome to define a custom widget only by setting
the template_name attribute on the template class and delegate
everything rendering-related to the template. The main difficulty is
to find the right template structure...
> Even a detail like "default zoom" can be tricky to get right: users
> expect a map to be zoomed to the maximum extent if there are geometries,
> or a default zoom if there are none, unless the existing geometry is a
> single point (which has zero extent).
I think the current situation is fine: we have default_zoom and
point_zoom. I can imagine use cases for dynamic values though...
> 3. A lot of my development work in olwidget in the last year was to
> implement code that allows a single map to edit geometries from multiple
> fields (with different fields on different layers), which was something
> many olwidget users had requested. This turns out to be fairly tricky
> to do, and adds a lot of complexity.... so I don't know if you want to
> go there.
My approach was to start with simpler things first :). More seriously,
the way django forms tend to work is to provide one widget per field,
leaving the more specific cases to 3rd party apps / snippets.
> 4. Final note: maps are for displaying as well as editing. It's possible
> that display-oriented maps are out of scope for editable map widgets,
> but if you take the time to implement a reasonable way for people to
> customize the look and feel of a map, it'd be great to be able to reuse
> that in a class for displaying maps.
This is tricky because there is no equivalent for this in the Django
codebase... With the current implementation you could define a widget
with modifiable=False and possibly other display-related options and
render it as a form without any submit button (and passing an initial
value coming from a geographic model).
Or you could have a template tag that renders a widget ({% map_widget
mymodel.geo_field %}) but again for this to be as generic as possible,
you'd need countless arguments and options and a good way to allow
extensibility.
> I'm still going to be maintaining olwidget for a while yet, but if an
> implementation in trunk reaches appropriate stability, I may retire it.
> Or if someone wants to make a competing or complementary integration of
> olwidget into trunk, you have my support (but not a lot of my time right
> now unfortunately).
For now I don't feel like making the port myself, I think olWidget
makes a lot of sense if basic widgets are added to trunk. We'll see
how things evolve :)
Cheers,
Bruno