From 4551d07d665a7bbb6f4569ba9adab880ef195d5e Mon Sep 17 00:00:00 2001 From: Paolo Pasquali Date: Mon, 6 Nov 2017 10:01:17 +0100 Subject: [PATCH 1/3] Add translations in home page. Fix #123 --- haitidata/locale/fr/LC_MESSAGES/django.mo | Bin 21190 -> 22957 bytes haitidata/locale/fr/LC_MESSAGES/django.po | 46 +++++++++++++--------- haitidata/templates/site_index.html | 14 +++---- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/haitidata/locale/fr/LC_MESSAGES/django.mo b/haitidata/locale/fr/LC_MESSAGES/django.mo index 4fc7ceee2da4207f44d46ac667a0c7d956cc2a09..6e32bdeef6f76d6cbaf814091e8097c59329e30a 100644 GIT binary patch delta 8937 zcmZvh2bdMr*~e$;z4tnlg$3^}MHE4#`_UH&ARrcI@6PTH?7efn1q6jFmY6SASQUvz zAp`}3buk)LA}qxgi3Kr!f=WVypCuAwqF_jV|Cw`PlPB}=-rs3+&U@ZA`{@2Hd5>4; zWskP0cdx}WG|#fS!R?JLYXj|3Z8d6H8#`Opc(@6A@DDHpi@R9XOt=>=fbF_k)({wj z{IeeBr#^haa5rp7{{Uu2Xv)B!VHxYz{}m zx^Oyd0%yTyaFLm>fNW_kgJa=37=iD=7MyQc-NP4KLTT6qO2ghz8x4VV;Ar?390wb~ zwmri4x;$Jm{#j9eTEZLQV7LzIqBXFA&VP?aM|cG4X5T=W{4^W`NB6|6 za5WqUKZjaZWQP_Q2BpAw)1L;V;6f-bE{3{D+Heh&rS61T+-Gf|p#?i2KCyN~S>SER zS=J|zOIvxp!ug(18w`eW!NpLPn*!yE*`_}a)}w!=VF}dD%VBG{vKRK3rnj4cD#I;M z8$So7z&@xO9*2s7FClSioigL~dWZeyQ0qHFDLfqNV)LN(D}n7`0!o2fdS}C%t~U!G zF%#8LKHLZ8yQAZVsiSt<#2fmKiz{vp)5^;sIy zaEqCE#`J5THvBErfyd1F=cfN1R1DPZ8=Af`yo7#hD1~N1xo|GjK2g)p7~TwZZn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JwEm(`ow~p<|{)=<`WFj}YGy9}|Vd zyTnG~cB1M?pr27xc+H&kw=*5r<7p<^Av>LiB|~y#$G3MlsNqP8B6K4 zKWmotE9DP~*7Wf|thnJ^6m5S{e=}$rdC#rKh|h>SiB5!$5yWxgm?|8x+}I4WLpA5G zjTFjlXzz%R6K@eZIyhKA;2T6Mq9xZQ6Z0uQM})>7M&TC)Ddj`NgG7rkQg@3v`5g`*S`vO@EHRF#NxVSpB;15eCr{x6#3G{V*hC?L_>EXg z{DTPR+UnQ{w_yy1<2}Tu#9V6(KL->%#5IDdeqR1^oTt`+8(+MkwKny=)Stegt*$9I z!J*|(HQpRiUcdQ*=<>rU$D>OpbXgd5+r=fm;v&D>E}CKorh5Fg-xF}#7$~x*xN4Y?jnD&E8uYz*dFhcB3~ipB5$gl=L)!Nmp9Lz<}JFXz@3-x zPE|))c=JQ2OZ@ImcKK&rlEcI7@`&zxqstHW?N+1o-He4PnFY2##g*>~ z*m)@>UbjsrGu%F=;kI2BWj>GFOJl|Q(yY;mk==UOxuw%aCq@*zeC1`C6JkokN39AD zbK8?kxSf05PFCFhP}QWx?XwHMn7f9gRBZ9v1)j-tU9n!*tNE{Kar^DOBCofijDlO8 z_?eK`>+<;hE-y*7^DD}#GU_Hf{t{o%F3?>SWlEWkVkn93f=~yXw+mdMB(fMMi4|q) zy1;Fd$LS?*5=SO0o)4wc

HaitiData

-

{% blocktrans %}HaitiData est une plate-forme conçue pour diffuser, partager et exploiter des données SIG et cartographiques sur Haïti. Une idée qui a vu le jour après le tremblement de terre du 12 janvier 2010 et dont la version initiale a été utilisée par plusieurs acteurs et partenaires engagés dans la gestion des risques et désastres, la planification urbaine, l’agriculture et la sécurité alimentaire, l’aménagement du territoire, la gestion de l’environnement, les infrastructures, les statistiques, le tourisme, la cartographie topographique, la cartographie thématique, etc.

-

Le CNIGS, en tant qu’agence nationale ayant pour mission officielle de collecter et diffuser des données spatialisées en Haïti (et principale entité étatique en termes de capacités en SIG), est donc chargé de la direction technique de la plate-forme.

-

Les données hébergées sur HaitiData sont accessibles au grand public et doivent contribuer à plus de synergies et une collaboration plus étroite entre les Ministères, les ONGs, la communauté internationale, les universités et le secteur privé.

-

HaitiData.org est basé sur la plateforme de GeoNode qui est une plateforme géo-spatiale open-source et un outil de technologie Web.{% endblocktrans %}

+

{% blocktrans %}HaitiData is a platform designed to disseminate, share and exploit GIS and cartographic data about Haiti. This idea was born after the earthquake of January 12, 2010. The first version of HaitiData has been used by several actors and partners involved in risk and disaster management, urban planning, agriculture and food security, spatial planning, environmental management, infrastructure, statistics, tourism, topographic mapping, thematic mapping, etc.{% endblocktrans %}

+

{% blocktrans %}CNIGS, as the national agency whose official mission is to collect and disseminate spatial data in Haiti (and the main governmental agency in terms of GIS capabilities), is therefore in charge of the platform.{% endblocktrans %}

+

{% blocktrans %}The data hosted on HaitiData is accessible to the general public and improves exchange and collaboration between Ministries, NGOs, the international community, academia and the private sector.{% endblocktrans %}

+

{% blocktrans %}HaitiData.org is based on GeoNode which is an open source geospatial platform and a web technology tool.{% endblocktrans %}

{% endblock %} @@ -64,16 +64,16 @@

{% blocktrans %}Imagery{% endblocktrans %}

-

{% blocktrans %}Cette section est un raccourci pour l'accès aux images aériennes et aux modèles numériques du terrain. Ces pages dédiées permettent de télécharger un sous-ensemble de ces données raster, extrait à partir de polygones dessinés directement sur la couche image.{% endblocktrans %}

+

{% blocktrans %}This section is a shortcut for access to aerial images and digital terrain models. These dedicated pages allow you to download a subset of these raster data, defined by drawing polygons on the same layer.{% endblocktrans %}

{% blocktrans %}Aerial images{% endblocktrans %}

-

{% blocktrans %}Couverture aérienne à résolution spatiale de 25 cm. La mosaïque est composée de 3617 jeux de données.{% endblocktrans %}

+

{% blocktrans %}It is an aerial coverage at a spatial resolution of 25 cm. The mosaic is composed of 3617 datasets.{% endblocktrans %}

{% blocktrans %}Aerial images{% endblocktrans %}

{% blocktrans %}DSM/DTM{% endblocktrans %}

-

{% blocktrans %}Le Modèle Numérique de Terrain a été produit par un vol LiDAR et avec une résolution spatiale de 1.5 m. Le mosaïque est composé de 1873 jeux de données.{% endblocktrans %}

+

{% blocktrans %}This is a numerical surface model derived from a LiDAR flight and with a spatial resolution of 1.5 m. The mosaic is composed by 1873 datasets.{% endblocktrans %}

{% blocktrans %}DSM/DTM{% endblocktrans %}
From 7db724e7ef599c1c01749ea88ac8a2caf6db7442 Mon Sep 17 00:00:00 2001 From: Paolo Pasquali Date: Mon, 6 Nov 2017 10:23:34 +0100 Subject: [PATCH 2/3] Minor changes to clip page --- haitidata/templates/clip-and-ship/clip-page.html | 2 +- haitidata/templates/clip-and-ship/download-clip.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/haitidata/templates/clip-and-ship/clip-page.html b/haitidata/templates/clip-and-ship/clip-page.html index e3b2e81..1325222 100644 --- a/haitidata/templates/clip-and-ship/clip-page.html +++ b/haitidata/templates/clip-and-ship/clip-page.html @@ -35,7 +35,7 @@ - +
diff --git a/haitidata/templates/clip-and-ship/download-clip.html b/haitidata/templates/clip-and-ship/download-clip.html index 8507a8f..e409d32 100644 --- a/haitidata/templates/clip-and-ship/download-clip.html +++ b/haitidata/templates/clip-and-ship/download-clip.html @@ -44,7 +44,7 @@ allowIntersection: false, drawError: { color: '#e1e100', - message: 'You can\'t draw that!' + message: 'Vous ne pouvez pas dessiner ça! - You can\'t draw that!' }, shapeOptions: { color: '#bada55' From 8c3c066e53a514265f64b3cad12327d7f9d579d1 Mon Sep 17 00:00:00 2001 From: Paolo Pasquali Date: Mon, 6 Nov 2017 15:16:24 +0100 Subject: [PATCH 3/3] Fix set thumbnail --- haitidata/settings.py | 3 +- haitidata/templates/layers/layer_detail.html | 17 ++++++--- haitidata/urls.py | 4 +- thumbnail/__init__.py | 0 thumbnail/admin.py | 3 ++ thumbnail/migrations/__init__.py | 0 thumbnail/models.py | 3 ++ thumbnail/tests.py | 3 ++ thumbnail/views.py | 40 ++++++++++++++++++++ 9 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 thumbnail/__init__.py create mode 100644 thumbnail/admin.py create mode 100644 thumbnail/migrations/__init__.py create mode 100644 thumbnail/models.py create mode 100644 thumbnail/tests.py create mode 100644 thumbnail/views.py diff --git a/haitidata/settings.py b/haitidata/settings.py index 61e61f6..ec4990e 100644 --- a/haitidata/settings.py +++ b/haitidata/settings.py @@ -98,7 +98,8 @@ INSTALLED_APPS = INSTALLED_APPS + ( 'charts_app', 'wfs_harvest', "clip-and-ship", - 'filter' + 'filter', + 'thumbnail' ) GEOSERVER_PUBLIC_LOCATION = os.environ.get( diff --git a/haitidata/templates/layers/layer_detail.html b/haitidata/templates/layers/layer_detail.html index 294e2ca..7c7b620 100644 --- a/haitidata/templates/layers/layer_detail.html +++ b/haitidata/templates/layers/layer_detail.html @@ -801,12 +801,19 @@ }); {% endif %} - + {% if GEONODE_SECURITY_ENABLED %} {% include "_permissions_form_js.html" %} diff --git a/haitidata/urls.py b/haitidata/urls.py index dc22c98..a301728 100644 --- a/haitidata/urls.py +++ b/haitidata/urls.py @@ -5,12 +5,14 @@ from osgeo_importer.urls import urlpatterns as importer_urlpatterns from geonode.urls import * from filter.urls import api_ext +from thumbnail.views import layer_thumbnail urlpatterns = patterns('', url(r'^/?$', TemplateView.as_view(template_name='site_index.html'), name='home'), - url(r'', include(api_ext.urls)) + url(r'', include(api_ext.urls)), + url(r'^layers/(?P[^/]*)/thumbnail$', layer_thumbnail, name='layer_thumbnail2'), ) + urlpatterns + [ url(r'^chart/', include('charts_app.urls')), url(r'^table/', include('wfs_harvest.urls')), diff --git a/thumbnail/__init__.py b/thumbnail/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/thumbnail/admin.py b/thumbnail/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/thumbnail/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/thumbnail/migrations/__init__.py b/thumbnail/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/thumbnail/models.py b/thumbnail/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/thumbnail/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/thumbnail/tests.py b/thumbnail/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/thumbnail/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/thumbnail/views.py b/thumbnail/views.py new file mode 100644 index 0000000..2c8d16b --- /dev/null +++ b/thumbnail/views.py @@ -0,0 +1,40 @@ +from django.shortcuts import render + +import base64 + +from django.http import HttpResponse, HttpResponseRedirect +from django.conf import settings +from geonode.layers.views import _resolve_layer +try: + import json +except ImportError: + from django.utils import simplejson as json + +if 'geonode.geoserver' in settings.INSTALLED_APPS: + from geonode.geoserver.helpers import _render_thumbnail + + +def layer_thumbnail(request, layername): + if request.method == 'POST': + layer_obj = _resolve_layer(request, layername) + try: + preview = json.loads(request.body).get('preview', None) + if preview and preview == 'react': + format, image = json.loads( + request.body)['image'].split(';base64,') + image = base64.b64decode(image) + else: + image = _render_thumbnail(request.body) + + if not image: + return + filename = "layer-%s-thumb.png" % layer_obj.uuid + layer_obj.save_thumbnail(filename, image) + + return HttpResponse('Thumbnail saved') + except: + return HttpResponse( + content='error saving thumbnail', + status=500, + content_type='text/plain' + )