[GeoNode-users] MapQuest changed direct tile access

Daniel Victoria daniel.victoria at gmail.com
Wed Jul 13 09:35:45 PDT 2016


Sent the email too fast. Sory.
I found a way around this problem by doing:
cat <python_script> | geonode shell

And just saw an error in my python script. It should be
MapLayer.objects.iterator() and not MapLayer.objects.iterate()

Cheers
Daniel

On Wed, Jul 13, 2016 at 1:27 PM, Daniel Victoria <daniel.victoria at gmail.com>
wrote:

> Hi Simone et al,
>
> Since we have a couple of servers running GeoNode, I though of placing the
> python commands to change the background values in a script that could by
> run ussing the 'geonode runscript' command. So I followed this Django
> runscript example [1] and for testing purposes, created a script to list
> all map names with the following content:
>
> -----
> # scripts/change_basemaps_maps.py
>
> from geonode.maps.models import MapLayer
>
> def run():
>     for m in MapLayer.objects.iterate():
>         print m.name
> -----
>
> When I issued the command 'geonode runscript
> /scripts/change_basemaps_maps' I got a large error about the leaflet
> plugin, copied bellow:
>
> daniel at daniel-VirtualBox:~/geonode/customizacao_ide_embrapa/scripts$
> geonode runscript change_basemap_maps
> Not enabling BingMaps base layer as a BING_API_KEY is not defined in
> local_settings.py file.
> Traceback (most recent call last):
>   File "/usr/bin/django-admin.py", line 5, in <module>
>     management.execute_from_command_line()
>   File
> "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line
> 399, in execute_from_command_line
>     utility.execute()
>   File
> "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line
> 392, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> line 242, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/usr/lib/python2.7/dist-packages/django/core/management/base.py",
> line 285, in execute
>     output = self.handle(*args, **options)
>   File
> "/usr/lib/pymodules/python2.7/django_extensions/management/commands/runscript.py",
> line 140, in handle
>     modules = find_modules_for_script(script)
>   File
> "/usr/lib/pymodules/python2.7/django_extensions/management/commands/runscript.py",
> line 115, in find_modules_for_script
>     mod = my_import("%s.%s.%s" % (app, subdir, script))
>   File
> "/usr/lib/pymodules/python2.7/django_extensions/management/commands/runscript.py",
> line 91, in my_import
>     path = imp.load_module(package, *module_tuple).__path__
>   File "/usr/lib/python2.7/dist-packages/leaflet/__init__.py", line 110,
> in <module>
>     raise ImproperlyConfigured(error_msg)
> django.core.exceptions.ImproperlyConfigured: LEAFLET_CONFIG['PLUGINS']
> must be dict of dicts in the format:
>     { '[plugin_name]': { 'js': '[path-to-js]', 'css': '[path-to-css]' } }
> .)
> daniel at daniel-VirtualBox:~/geonode/customizacao_ide_embrapa/scripts$
>
> Is there something else that is broken and that's why I can't call my
> script? Any idea how to fix this?
>
> Thanks
> Daniel
>
> [1] - http://django-extensions.readthedocs.io/en/latest/runscript.html
>
> On Wed, Jul 13, 2016 at 11:29 AM, Daniel Victoria <
> daniel.victoria at gmail.com> wrote:
>
>> Great, will try that. Thanks
>>
>> On Wed, Jul 13, 2016 at 11:12 AM, Simone Dalmasso <
>> simone.dalmasso at gmail.com> wrote:
>>
>>> Hi, you have to remove mapquest from your settings like here
>>>
>>> https://github.com/GeoNode/geonode/commit/42d589cd9d86fa76fc9a9afd2eeacdf64c939705
>>>
>>> and make mapnik the default one like here:
>>>
>>> https://github.com/GeoNode/geonode/commit/8cb080534e69c590c8864a2603b2ea1eca2e8a73
>>>
>>> 2016-07-13 16:08 GMT+02:00 Daniel Victoria <daniel.victoria at gmail.com>:
>>>
>>>> Hi,
>>>>
>>>> This worked for my saved maps. Thanks.
>>>>
>>>> But how about the layers page (e.g.: /layers/geonode%4A<some layer
>>>> name>) ? I'm still getting Mapquest as default background. Where do I
>>>> change that?
>>>>
>>>> cheers
>>>> Daniel
>>>>
>>>> On Wed, Jul 13, 2016 at 10:09 AM, Simone Dalmasso <
>>>> simone.dalmasso at gmail.com> wrote:
>>>>
>>>>> Hi, the following commands will use mapnik instead of mapquest
>>>>> background for all saved maps:
>>>>>
>>>>> $ geonode shell
>>>>> >>>from geonode.maps.models import MapLayer
>>>>> >>>MapLayer.objects.filter(name='osm').update(visibility=False)
>>>>> >>>MapLayer.objects.filter(name='mapnik').update(visibility=True)
>>>>>
>>>>>
>>>>> for new maps you can remove the mapquest entries in MAP_BASELAYERS.
>>>>>
>>>>> Hope this helps
>>>>>
>>>>> 2016-07-13 14:45 GMT+02:00 Daniel Victoria <daniel.victoria at gmail.com>
>>>>> :
>>>>>
>>>>>> Hi list,
>>>>>>
>>>>>> This is probably affecting others. I just opened a layer in GeoNode
>>>>>> and saw that MapQuest changed their direct tile access policy [1]. Thus,
>>>>>> the background of all my layers are messed up.
>>>>>> How can I make geonode use some other basemap as default? Or fix my
>>>>>> basemap issue?
>>>>>>
>>>>>> Thanks
>>>>>> Daniel
>>>>>>
>>>>>> [1] -
>>>>>> http://devblog.mapquest.com/2016/06/15/modernization-of-mapquest-results-in-changes-to-open-tile-access/
>>>>>>
>>>>>> _______________________________________________
>>>>>> geonode-users mailing list
>>>>>> geonode-users at lists.osgeo.org
>>>>>> http://lists.osgeo.org/mailman/listinfo/geonode-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Simone
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Simone
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20160713/a6365fab/attachment-0001.html>


More information about the geonode-users mailing list