Skip to content
Snippets Groups Projects
Commit a4314af5 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Merging conflicts fix

parents 4733667c 9ffee344
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,8 @@ public class RoughageService {
@QueryParam("firstHarvest") String firstHarvestStr,
@QueryParam("secondHarvest") String secondHarvestStr,
@QueryParam("soilType") Integer soilType,
@QueryParam("cloverShare") Integer cloverShare
@QueryParam("cloverShare") Integer cloverShare,
@QueryParam("userWeatherScenarios") String useWeatherScenarios
)
{
ParseRESTParamUtil parseUtil = new ParseRESTParamUtil();
......@@ -79,7 +80,10 @@ public class RoughageService {
cal.setTime(firstHarvest);
cal.set(Calendar.MONTH, Calendar.APRIL);
cal.set(Calendar.DATE, 1);
Date aprilFirst = new WeatherUtil().normalizeToExactDate(cal.getTime(), timeZone);
WeatherUtil wUtil = new WeatherUtil();
Date aprilFirst = wUtil.normalizeToExactDate(cal.getTime(), timeZone);
// End date for weather data depends on season
// We try September 30th. If that's in the future,
// We add 10 days to today
......@@ -122,6 +126,43 @@ public class RoughageService {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex.getMessage()).build();
}
// Add weather scenarios??
if(useWeatherScenarios != null && useWeatherScenarios.equals("true"))
{
Date latestObsDate = wUtil.getLastObservations(observations, "TM", 1).get(0).getTimeMeasured();
Date scenarioEndDate = secondHarvest != null ? secondHarvest : firstHarvest;
Double averageEvaporation = wUtil.getAverage(
wUtil.getObservationValues(
wUtil.getLastObservations(observations, "EPP", 5)
)
);
cal.setTime(latestObsDate);
cal.add(Calendar.DATE, 1);
Date currentDate = cal.getTime();
WeatherObservation scenarioTpl = new WeatherObservation();
scenarioTpl.setLogIntervalId(WeatherObservation.LOG_INTERVAL_ID_1D);
scenarioTpl.setValue(averageEvaporation);
String[] parameters = {WeatherElements.POTENTIAL_EVAPORATION,WeatherElements.TEMPERATURE_MEAN,WeatherElements.PRECIPITATION,WeatherElements.GLOBAL_RADIATION};
while(currentDate.before(scenarioEndDate))
{
scenarioTpl.setTimeMeasured(currentDate);
for(String param:parameters)
{
WeatherObservation scenarioObs = new WeatherObservation(scenarioTpl);
scenarioObs.setElementMeasurementTypeId(param);
observations.add(scenarioObs);
}
cal.setTime(currentDate);
cal.add(Calendar.DATE, 1);
currentDate = cal.getTime();
}
}
ModelConfiguration config = new ModelConfiguration();
config.setModelId("ROUGHAGENU");
config.setConfigParameter("observations", observations);
......
.layer-switcher {
position: absolute;
top: 3.5em;
right: 0.5em;
text-align: left;
}
.layer-switcher .panel {
padding-right: 50px;
border: 1px solid #cccccc;
background-color: white;
margin: 0;
display: none;
}
.layer-switcher.shown .panel {
display: block;
}
.layer-switcher button {
float: right;
width: 38px;
height: 38px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACE1BMVEX///8A//8AgICA//8AVVVAQID///8rVVVJtttgv98nTmJ2xNgkW1ttyNsmWWZmzNZYxM4gWGgeU2JmzNNr0N1Rwc0eU2VXxdEhV2JqytQeVmMhVmNoydUfVGUgVGQfVGQfVmVqy9hqy9dWw9AfVWRpydVry9YhVmMgVGNUw9BrytchVWRexdGw294gVWQgVmUhVWPd4N6HoaZsy9cfVmQgVGRrytZsy9cgVWQgVWMgVWRsy9YfVWNsy9YgVWVty9YgVWVry9UgVWRsy9Zsy9UfVWRsy9YgVWVty9YgVWRty9Vsy9aM09sgVWRTws/AzM0gVWRtzNYgVWRuy9Zsy9cgVWRGcHxty9bb5ORbxdEgVWRty9bn6OZTws9mydRfxtLX3Nva5eRix9NFcXxOd4JPeINQeIMiVmVUws9Vws9Vw9BXw9BYxNBaxNBbxNBcxdJexdElWWgmWmhjyNRlx9IqXGtoipNpytVqytVryNNrytZsjZUuX210k5t1y9R2zNR3y9V4lp57zth9zdaAnKOGoaeK0NiNpquV09mesrag1tuitbmj1tuj19uktrqr2d2svcCu2d2xwMO63N+7x8nA3uDC3uDFz9DK4eHL4eLN4eIyYnDX5OM5Z3Tb397e4uDf4uHf5uXi5ePi5+Xj5+Xk5+Xm5+Xm6OY6aHXQ19fT4+NfhI1Ww89gx9Nhx9Nsy9ZWw9Dpj2abAAAAWnRSTlMAAQICAwQEBgcIDQ0ODhQZGiAiIyYpKywvNTs+QklPUlNUWWJjaGt0dnd+hIWFh4mNjZCSm6CpsbW2t7nDzNDT1dje5efr7PHy9PT29/j4+Pn5+vr8/f39/f6DPtKwAAABTklEQVR4Xr3QVWPbMBSAUTVFZmZmhhSXMjNvkhwqMzMzMzPDeD+xASvObKePPa+ffHVl8PlsnE0+qPpBuQjVJjno6pZpSKXYl7/bZyFaQxhf98hHDKEppwdWIW1frFnrxSOWHFfWesSEWC6R/P4zOFrix3TzDFLlXRTR8c0fEEJ1/itpo7SVO9Jdr1DVxZ0USyjZsEY5vZfiiAC0UoTGOrm9PZLuRl8X+Dq1HQtoFbJZbv61i+Poblh/97TC7n0neCcK0ETNUrz1/xPHf+DNAW9Ac6t8O8WH3Vp98f5lCaYKAOFZMLyHL4Y0fe319idMNgMMp+zWVSybUed/+/h7I4wRAG1W6XDy4XmjR9HnzvDRZXUAYDFOhC1S/Hh+fIXxen+eO+AKqbs+wAo30zDTDvDxKoJN88sjUzDFAvBzEUGFsnADoIvAJzoh2BZ8sner+Ke/vwECuQAAAABJRU5ErkJggg==') /*logo.png*/;
background-repeat: no-repeat;
background-position: 2px;
background-color: white;
border: none;
}
.layer-switcher button:focus, .layer-switcher button:hover {
background-color: white;
}
.layer-switcher ul {
padding-left: 1em;
list-style: none;
}
.layer-switcher li.group {
padding-top: 5px;
}
.layer-switcher li.group > label {
font-weight: bold;
}
.layer-switcher input {
margin: 4px;
}
......@@ -57,6 +57,20 @@ function initMap(center, zoomLevel, displayMarker, drawnObjs) {
})
});
var topo2graatone = new ol.layer.Tile({
title: "Gråtone",
type: 'base',
visible: false,
source: new ol.source.TileWMS({
url: "http://opencache.statkart.no/gatekeeper/gk/gk.open?",
params: {
LAYERS: 'topo2graatone',
VERSION: '1.1.1'
}
})
});
var fylke_layer = new ol.layer.Vector({
title: 'Fylkesgrenser',
type: 'overlay',
......@@ -64,7 +78,7 @@ function initMap(center, zoomLevel, displayMarker, drawnObjs) {
source: new ol.source.Vector({
projection: 'EPSG:3857',
format: new ol.format.GeoJSON(),
url: '/geoserver/ows?srsname=EPSG:3857&format_options=decimals:0&service=WFS&version=1.0.0&outputFormat=json&request=GetFeature&typeName=sl:n5_forv_fylke_mv&'
url: 'http://kart13.skogoglandskap.no/geoserver/ows?srsname=EPSG:3857&format_options=decimals:0&service=WFS&version=1.0.0&outputFormat=json&request=GetFeature&typeName=sl:n5_forv_fylke_mv&'
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
......@@ -80,7 +94,7 @@ function initMap(center, zoomLevel, displayMarker, drawnObjs) {
source: new ol.source.Vector({
projection: 'EPSG:3857',
format: new ol.format.GeoJSON(),
url: '/geoserver/ows?srsname=EPSG:3857&format_options=decimals:0&service=WFS&version=1.0.0&outputFormat=json&request=GetFeature&typeName=sl:n2000_komm_flate&'
url: 'http://kart13.skogoglandskap.no/geoserver/ows?srsname=EPSG:3857&format_options=decimals:0&service=WFS&version=1.0.0&outputFormat=json&request=GetFeature&typeName=sl:n2000_komm_flate&'
}),
style: new ol.style.Style({
stroke: new ol.style.Stroke({
......@@ -95,7 +109,7 @@ function initMap(center, zoomLevel, displayMarker, drawnObjs) {
var map = new ol.Map({
target: 'observationFormMap',
//layers: layers,
layers: [osm, bingArial, fylke_layer, kommune_layer],
layers: [osm, bingArial, topo2graatone, fylke_layer, kommune_layer],
renderer: 'canvas'
});
......
......@@ -21,6 +21,7 @@
<#macro custom_css>
<link rel="stylesheet" type="text/css" href="/css/3rdparty/jquery.datetimepicker.css"/ >
<link rel="stylesheet" type="text/css" href="/css/3rdparty/ol.css"/ >
<link rel="stylesheet" type="text/css" href="/css/3rdparty/ol3-layerswitcher.css"/ >
<link rel="stylesheet" type="text/css" href="/css/map.css"/ >
</#macro>
<#macro custom_js>
......@@ -130,11 +131,9 @@
<label>What do you want to draw</label>
<select id="type">
<option value="Point">Point</option>
<option value="LineString">Line</option>
<option value="Polygon">Polygon</option>
</select>
<button id="delete" type="button">Clear all</button>
<button id="save-button" type="button">Save</button>
</div>
<div id="observationFormMap" class="map">
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment