Initial commit
This commit is contained in:
57
public/assets/js/permit_tools.js
Normal file
57
public/assets/js/permit_tools.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// Where you want to render the map.
|
||||
var element = document.getElementById('applicationmap');
|
||||
|
||||
// Height has to be set. You can do this in CSS too.
|
||||
//element.style = 'height:450px;';
|
||||
|
||||
var defaultWKT = 'POLYGON((-1.22 7.14, -1.17 7.14, -1.17 7.26, -1.22 7.26, -1.22 7.14))';
|
||||
searchLayer = new ol.layer.Vector({
|
||||
title : 'Search Layer',
|
||||
source : undefined,
|
||||
style : new ol.style.Style({
|
||||
stroke : new ol.style.Stroke({
|
||||
color : 'red',
|
||||
width : 3
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
// Create Openlayers map on map element.
|
||||
var map = new ol.Map({
|
||||
layers: [
|
||||
new ol.layer.Tile({
|
||||
source: new ol.source.OSM()
|
||||
})
|
||||
],
|
||||
target: element,
|
||||
controls: ol.control.defaults().extend([
|
||||
new ol.control.MousePosition({
|
||||
projection: 'EPSG:4326',
|
||||
coordinateFormat: function(coordinate) {
|
||||
return ol.coordinate.format(coordinate, '{x}, {y}', 4);
|
||||
},
|
||||
}),
|
||||
new ol.control.ScaleLine(),
|
||||
]),
|
||||
view: new ol.View({
|
||||
center: [-135846.63, 891762.35],
|
||||
zoom: 6
|
||||
})
|
||||
});
|
||||
|
||||
map.addLayer(searchLayer);
|
||||
|
||||
searchLayer.setSource(new ol.source.Vector({features : (new ol.format.WKT()).readFeatures(defaultWKT)}));
|
||||
view.fit(searchLayer.getSource().getExtent());
|
||||
pvlmd_map.getView().fit(searchLayer.getSource().getExtent(),{size : map.getSize(),maxZoom : 16})
|
||||
|
||||
|
||||
function viewApplication(applicationId) {
|
||||
console.log(applicationId);
|
||||
window.location.href = "/permits/viewapplication?id=" + applicationId;
|
||||
}
|
||||
|
||||
function viewPending() {
|
||||
console.log('foo bar');
|
||||
window.location.href = "/permits/pending";
|
||||
}
|
||||
Reference in New Issue
Block a user