useless merge

This commit is contained in:
Schuyler Erle 2011-08-27 17:52:34 -07:00
commit 5ed7e0f0b5
2 changed files with 21 additions and 4 deletions

View File

@ -1,7 +1,10 @@
$(function() { $(function() {
map = new OpenLayers.Map('map', {}); map = new OpenLayers.Map('map', {});
var baseLayer = new OpenLayers.Layer.OSM( "Openstreetmap Base Layer"); var baseLayer = new OpenLayers.Layer.OSM( "Openstreetmap Base Layer");
map.addLayer(baseLayer); // map.addLayer(baseLayer);
var geojson_format = new OpenLayers.Format.GeoJSON();
var jsonLayer = new OpenLayers.Layer.Vector();
map.addLayers([baseLayer, jsonLayer]);
var center = new OpenLayers.LonLat(-95, 37.5).transform( var center = new OpenLayers.LonLat(-95, 37.5).transform(
new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject() map.getProjectionObject()
@ -16,10 +19,24 @@ $(function() {
$.getJSON("search_json", { $.getJSON("search_json", {
'bbox': bbox, 'bbox': bbox,
'search': search_term 'search': search_term
}, function(response) { }, function(features) {
console.log(response); $('#mapList').empty();
// console.log(response);
var currFeatures = jsonLayer.features;
jsonLayer.removeFeatures(currFeatures);
jsonLayer.addFeatures(geojson_format.read(features));
for (var i=0; i<features.features.length;i++) {
var f = features.features[i];
var props = f.properties;
var listItem = getLi(props);
$('#mapList').append(listItem);
}
}); });
}); });
}); });
function getLi(props) {
var $li = $('<li />').addClass("mapListItem").attr("data-id", props.id);
var $a = $('<a />').attr("target", "_blank").attr("href", "/admin/places/feature/" + props.id).text(props.preferred_name).appendTo($li);
return $li;
}

View File