layer choser for wms feeds
This commit is contained in:
parent
0b78f091c4
commit
aaeed4456b
|
@ -4,7 +4,7 @@ var creds = {
|
|||
}
|
||||
var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/' + creds.cloudmade + '/997/256/{z}/{x}/{y}.png',
|
||||
cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18}),
|
||||
map = new L.Map('map', {layers: [cloudmade], center: new L.LatLng(-37.7772, 175.2756), zoom: 15 });
|
||||
map = new L.Map('map', {layers: [cloudmade], center: new L.LatLng(19.11577, 72.855211), zoom: 11 });
|
||||
|
||||
var drawControl = new L.Control.Draw({
|
||||
// position: 'topright',
|
||||
|
@ -139,8 +139,17 @@ map.addLayer(drawnItems);
|
|||
// })
|
||||
// .addTo(map);
|
||||
|
||||
wmsLayers = {};
|
||||
wmsLayers['Test Warped Map'] = L.tileLayer.wms("http://mapwarper.net/maps/wms/336", {
|
||||
'format': 'image/png'
|
||||
});//.addTo(map);
|
||||
|
||||
loadGeoJsonFeatures("/geojson/10/");
|
||||
|
||||
|
||||
L.control.layers(null, wmsLayers).addTo(map);
|
||||
|
||||
|
||||
loadGeoJsonFeatures("/geojson/" + CONTENT_TYPE_ID);
|
||||
|
||||
function loadGeoJsonFeatures(url, params) {
|
||||
//alert("hi");
|
||||
|
@ -204,4 +213,9 @@ function loadGeoJsonFeatures(url, params) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
$(function() {
|
||||
$('#ctypeList').change(function() {
|
||||
var ctype_id = $(this).val();
|
||||
location.href = '/edit/' + ctype_id;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,21 @@
|
|||
# Create your views here.
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render_to_response
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
def index(request):
|
||||
context = RequestContext(request, {})
|
||||
return render_to_response("index.html", context)
|
||||
|
||||
def edit(request):
|
||||
context = RequestContext(request, {})
|
||||
def edit(request, ctype_id):
|
||||
ctypes = []
|
||||
content_type_id = int(ctype_id)
|
||||
for c in ContentType.objects.all():
|
||||
if hasattr(c.model_class(), 'is_openmumbai_model'):
|
||||
ctypes.append(c)
|
||||
|
||||
context = RequestContext(request, {
|
||||
'ctypes': ctypes,
|
||||
'content_type_id': ctype_id
|
||||
})
|
||||
return render_to_response("edit.html", context)
|
||||
|
|
|
@ -36,12 +36,22 @@ html, body {
|
|||
<script src="/static/leaflet/leaflet.js"></script>
|
||||
<script src="/static/leaflet/leaflet.draw.js"></script>
|
||||
<script src="http://code.jquery.com/jquery.js"></script>
|
||||
<script>
|
||||
CONTENT_TYPE_ID = {{ content_type_id }};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="map"></div>
|
||||
<div id="overlayWrapper">
|
||||
<select id="ctypeList">
|
||||
{% for c in ctypes %}
|
||||
<option value="{{ c.id }}" {% ifequal c.id content_type_id %} selected="selected" {% endifequal %}>
|
||||
{{ c.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<ul id="itemsList">
|
||||
</ul>
|
||||
<div id="itemInfo">
|
||||
|
|
|
@ -14,8 +14,8 @@ urlpatterns = patterns('',
|
|||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
url(r'^$', 'places.views.index', name='index'),
|
||||
url(r'^geojson/(?P<ctype_id>[0-9]+)/$', 'base.views.geojson', name='geojson'),
|
||||
url(r'^edit/$', 'places.views.edit', name='edit'),
|
||||
url(r'^geojson/(?P<ctype_id>[0-9]+)$', 'base.views.geojson', name='geojson'),
|
||||
url(r'^edit/(?P<ctype_id>[0-9]+)$', 'places.views.edit', name='edit'),
|
||||
# Uncomment the next line to enable the admin:
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user