hey all. I've been working on making GeoNode use a less customized format for transferring map details between gxp Viewers and the Django app. I took the opportunity to make another step in the 'heavy models, light views' direction. geonode.maps.views.build_map_config(map) has been replaced with geonode.maps.models.Map.viewer_json(*extra_layers) geonode.maps.views.create_map_json(config) and update_map_json(config) have both been replaced with geonode.maps.models.Map.update_from_viewer(config). (update_from_viewer saves the generated map configuration, be warned). You can see how these are used in my branch at http://github.com/dwins/geonode/compare/master...issue-566 Basically, whenever we want to make a viewer configuration, we should create a Map instance (if we don't want to save to the database, we don't have to) and use its viewer_json, rather than repeating the logic of making a correct viewer config throughout the code. See the fall-through case in layerController for an example. http://github.com/dwins/geonode/blob/issue-566/src/GeoNodePy/geonode/maps/views.py#L511 I'm going to write some better docs in the docstrings, but I wanted to go ahead and bring it up on the list in case anyone sees an obvious flaw in the approach. -- David Winslow OpenGeo - http://opengeo.org/
This sounds like an awesome improvement! I'm looking forward to working with it. Two thoughts: (a) One related issue that I've been trying to figure out while working on map composition workflows and home page layout is the role of the "Default Map." It was very necessary when the home page *had* to show a map, but now I guess its only use is that it's what the map composer loads with when a new map is loaded? Just trying to figure out the story on this, as it probably should affect what the default map actually is. (b) Relatedly: in your looking into this, have you come across this file: src/GeoNodePy/geonode/templates/maps/view.json ? I've been trying to figure out what its for (whatever it is, I think it's been made obsolete by your branch) On Fri, Jul 16, 2010 at 11:41 AM, David Winslow <dwinslow@opengeo.org>wrote: > hey all. I've been working on making GeoNode use a less customized > format for transferring map details between gxp Viewers and the Django > app. I took the opportunity to make another step in the 'heavy models, > light views' direction. > > geonode.maps.views.build_map_config(map) has been replaced with > geonode.maps.models.Map.viewer_json(*extra_layers) > geonode.maps.views.create_map_json(config) and update_map_json(config) > have both been replaced with > geonode.maps.models.Map.update_from_viewer(config). (update_from_viewer > saves the generated map configuration, be warned). > > You can see how these are used in my branch at > http://github.com/dwins/geonode/compare/master...issue-566 > > Basically, whenever we want to make a viewer configuration, we should > create a Map instance (if we don't want to save to the database, we > don't have to) and use its viewer_json, rather than repeating the logic > of making a correct viewer config throughout the code. See the > fall-through case in layerController for an example. > > > http://github.com/dwins/geonode/blob/issue-566/src/GeoNodePy/geonode/maps/views.py#L511 > > I'm going to write some better docs in the docstrings, but I wanted to > go ahead and bring it up on the list in case anyone sees an obvious flaw > in the approach. > > -- > David Winslow > OpenGeo - http://opengeo.org/ > -- Sebastian Benthall OpenGeo - http://opengeo.org
On 07/16/2010 12:11 PM, Sebastian Benthall wrote: > This sounds like an awesome improvement! I'm looking forward to > working with it. > > Two thoughts: > > (a) One related issue that I've been trying to figure out while > working on map composition workflows and home page layout is the role > of the "Default Map." It was very necessary when the home page *had* > to show a map, but now I guess its only use is that it's what the map > composer loads with when a new map is loaded? Just trying to figure > out the story on this, as it probably should affect what the default > map actually is. I believe that's right, the DEFAULT_MAP_CONFIG is used just for the home page and for the newmap view. > > (b) Relatedly: in your looking into this, have you come across this > file: src/GeoNodePy/geonode/templates/maps/view.json ? > > I've been trying to figure out what its for (whatever it is, I think > it's been made obsolete by your branch) > Nope, I'll take a look though. > > On Fri, Jul 16, 2010 at 11:41 AM, David Winslow <dwinslow@opengeo.org > <mailto:dwinslow@opengeo.org>> wrote: > > hey all. I've been working on making GeoNode use a less customized > format for transferring map details between gxp Viewers and the Django > app. I took the opportunity to make another step in the 'heavy > models, > light views' direction. > > geonode.maps.views.build_map_config(map) has been replaced with > geonode.maps.models.Map.viewer_json(*extra_layers) > geonode.maps.views.create_map_json(config) and update_map_json(config) > have both been replaced with > geonode.maps.models.Map.update_from_viewer(config). > (update_from_viewer > saves the generated map configuration, be warned). > > You can see how these are used in my branch at > http://github.com/dwins/geonode/compare/master...issue-566 > > Basically, whenever we want to make a viewer configuration, we should > create a Map instance (if we don't want to save to the database, we > don't have to) and use its viewer_json, rather than repeating the > logic > of making a correct viewer config throughout the code. See the > fall-through case in layerController for an example. > > http://github.com/dwins/geonode/blob/issue-566/src/GeoNodePy/geonode/maps/views.py#L511 > > I'm going to write some better docs in the docstrings, but I wanted to > go ahead and bring it up on the list in case anyone sees an > obvious flaw > in the approach. > > -- > David Winslow > OpenGeo - http://opengeo.org/ > > > > > -- > Sebastian Benthall > OpenGeo - http://opengeo.org >