cannot set opacity level of layers

Issue #1 resolved
romain_janvier
created an issue

Hello, this is maybe a bug

Using Django 1.2.1 and Django-geoportal 0.4.2

-setting:

layers = ( ('photos', 1), )

the map is ok in the admin interface

-setting: layers = ( ('photos', 1), ('maps', 0.3), ) I can't view the map in the admin interface (the area is white)

Best regards, Romain

Comments (9)

  1. Bruno repo owner
    • changed status to open

    Hi,

    I can't reproduce the bug. Settings layers works just fine. I'm assuming you have in your admin.py:

    from geoportal import admin
    from myapp.models import MyModel
    
    class MapGeoAdmin(admin.GeoPortalAdmin):
        layers = (
            ('photos', 1),
            ('maps', 0.4),
        )
    
    admin.site.register(MyModel, MapGeoAdmin)
    

    If the layers are not displayed properly with this code, can you check with Firebug that requests made to wxs.ign.fr actually return 200 OK responses?

    Can you display a map layer at all? using

    layers = (
        ('maps', 1),
    )
    
  2. romain_janvier reporter

    yes, it works fine with ('maps',1)

    here is my code

    from Monnaies.corpus.models import *
    import geoportal
    from django.contrib import admin
    
    
    class PointAdmin(geoportal.admin.GeoPortalAdmin):
        layers = ( 
                  ('photos', 1),
                  ('maps', 0.4),
        )
    
    class RefAdmin(admin.TabularInline):
        model = ValeurRef
        extra = 1
    
    class MonnaieAdmin(admin.ModelAdmin):
        inlines = (RefAdmin,)
    
    admin.site.register(Monnaie, MonnaieAdmin)
    admin.site.register(Reference)
    admin.site.register(Atelier, PointAdmin)
    admin.site.register(Autorite)
    admin.site.register(Contexte, PointAdmin)
    admin.site.register(Collection, PointAdmin)
    

    and the screenshot a white area of the size of the map

    I don't know how to check the requests responses in firebug...

  3. Bruno repo owner

    Ok, your code looks fine. If you can display maps it's not an issue with IGN's servers.

    Regarding Firebug, just open it and reload the page. The interesting tabs are "Console" and "Net". Let me know if there is any error in the console...

  4. Bruno repo owner

    Ok, found it.

    Your django installation is in French, and the template language escapes '0.4' as '0,4' which triggers a javascript syntax error.

    A quick fix would be to declare float opacity values as strings:

    layers = (
        ('maps', 1),
        ('photos', '0.4'),  # <-- 0.4 as a string
    )
    

    I'll write a fix soon but using strings should solve the problem for now. Thanks for the report :-)

  5. Log in to comment