diff --git a/geonode/maps/qgis_server_views.py b/geonode/maps/qgis_server_views.py index 36bec8357c0..ed69106ab81 100644 --- a/geonode/maps/qgis_server_views.py +++ b/geonode/maps/qgis_server_views.py @@ -26,7 +26,6 @@ from django.utils.decorators import method_decorator from django.core.urlresolvers import reverse from django.http import HttpResponse -from django.shortcuts import render from geonode.maps.views import _resolve_map, _PERMISSION_MSG_VIEW, \ snapshot_config @@ -217,35 +216,3 @@ def perm_filter(layer): % map_obj.title + '.qlr' return response - - -def map_embed_widget(request, mapid, - template='leaflet_maps/map_embed_widget.html'): - """Display code snippet for embedding widget. - - :param request: The request from the frontend. - :type request: HttpRequest - - :param mapid: The id of the map. - :type mapid: String - - :return: formatted code. - """ - - map_obj = _resolve_map(request, - mapid, - 'base.view_resourcebase', - _PERMISSION_MSG_VIEW) - map_layers = MapLayer.objects.filter( - map_id=mapid).order_by('stack_order') - layers = [] - for layer in map_layers: - if layer.group != 'background': - layers.append(layer) - - context = { - 'resource': map_obj, - 'map_layers': layers - } - message = render(request, template, context) - return HttpResponse(message) diff --git a/geonode/maps/templates/leaflet_maps/map_embed_widget.html b/geonode/maps/templates/leaflet_maps/map_embed_widget.html index fa0704351ee..5ce407fb506 100644 --- a/geonode/maps/templates/leaflet_maps/map_embed_widget.html +++ b/geonode/maps/templates/leaflet_maps/map_embed_widget.html @@ -7,7 +7,12 @@ $(document).ready(function () { var wmsLayer = null; var firstProjection = proj4('EPSG:3857'); + + {% if resource.srid %} + var secondProjection = proj4('{{ resource.srid }}'); + {% else %} var secondProjection = proj4('EPSG:4326'); + {% endif %} var point_wsg84 = proj4(firstProjection, secondProjection, [{{ resource.center_x }}, {{ resource.center_y }}]); var map = L.map('map').setView([point_wsg84[1], point_wsg84[0]], 6); @@ -16,7 +21,6 @@ }); map.addLayer(osm); - firstProjection = proj4('{{ resource.srid }}'); var corner0 = [{{ resource.bbox_x0 }}, {{ resource.bbox_y0 }}]; var corner1 = [{{ resource.bbox_x1 }}, {{ resource.bbox_y1 }}]; diff --git a/geonode/maps/templates/maps/map_detail.html b/geonode/maps/templates/maps/map_detail.html index 5d10281d530..fdf38914997 100644 --- a/geonode/maps/templates/maps/map_detail.html +++ b/geonode/maps/templates/maps/map_detail.html @@ -291,6 +291,7 @@

                 
                 
             
@@ -310,6 +311,7 @@ 
       {% overall_rating resource "map" as the_map_rating %}
 {% endif %}
 {% include 'rating.html' %}
+