geojson
This commit is contained in:
@ -2,12 +2,7 @@ package org.ccalm.main;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -263,6 +258,8 @@ public class GeoGSON implements ServletContextAware {
|
||||
@ResponseBody
|
||||
public ResponseEntity<byte[]> podsDensity(
|
||||
@RequestParam(required = false, name = "country_id", defaultValue = "5") Integer countryId,
|
||||
@RequestParam(required = false, name = "region_id") Long regionId,
|
||||
@RequestParam(required = false, name = "locust_type_id") Long locustTypeId,
|
||||
@RequestParam(required = false, name = "date_start", defaultValue = "1750227418") Long dateStartUnix,
|
||||
@RequestParam(required = false, name = "date_end", defaultValue = "1758010618") Long dateEndUnix,
|
||||
@CookieValue(value = "lng", defaultValue = "1") String language_id,
|
||||
@ -276,16 +273,21 @@ public class GeoGSON implements ServletContextAware {
|
||||
ST_AsGeoJSON(st_setsrid(st_makepoint(fl.lon_center, fl.lat_center), 4326)) AS geometry
|
||||
FROM main.frmlocust fl
|
||||
WHERE 1=1
|
||||
AND geom IS NOT NULL
|
||||
AND fl.lon_center IS NOT NULL
|
||||
AND fl.lat_center IS NOT NULL
|
||||
AND (:countryId IS NULL OR fl.country_id = :countryId)
|
||||
AND (:regionId IS NULL OR fl.region_id = :regionId)
|
||||
AND (:locustTypeId IS NULL OR fl.locust_type_id = :locustTypeId)
|
||||
AND (:dateFrom IS NULL OR fl.date >= to_timestamp(:dateFrom))
|
||||
AND (:dateTo IS NULL OR fl.date <= to_timestamp(:dateTo))
|
||||
""";
|
||||
|
||||
MapSqlParameterSource params = new MapSqlParameterSource();
|
||||
params.addValue("countryId", countryId);
|
||||
params.addValue("dateFrom", dateStartUnix);
|
||||
params.addValue("dateTo", dateEndUnix);
|
||||
params.addValue("countryId", countryId, Types.BIGINT);
|
||||
params.addValue("regionId", regionId, Types.BIGINT);
|
||||
params.addValue("locustTypeId", locustTypeId, Types.BIGINT);
|
||||
params.addValue("dateFrom", dateStartUnix, Types.BIGINT);
|
||||
params.addValue("dateTo", dateEndUnix, Types.BIGINT);
|
||||
|
||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, params);
|
||||
|
||||
|
||||
@ -141,6 +141,10 @@ public class QGIS implements ServletContextAware {
|
||||
sql2+="&country_id="+country_id;
|
||||
}
|
||||
}
|
||||
if(region_id!=null && !region_id.isEmpty())
|
||||
{
|
||||
sql+="&region_id="+region_id;
|
||||
}
|
||||
if(locust_type_id!=null && !locust_type_id.isEmpty())
|
||||
{
|
||||
sql+="&locust_type_id="+locust_type_id;
|
||||
@ -155,7 +159,7 @@ public class QGIS implements ServletContextAware {
|
||||
if(date_end!=null && !date_end.isEmpty())
|
||||
{
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
LocalDateTime localDateTime = LocalDateTime.parse(date_start, formatter);
|
||||
LocalDateTime localDateTime = LocalDateTime.parse(date_end, formatter);
|
||||
long epochSeconds = localDateTime.toEpochSecond(ZoneOffset.UTC);
|
||||
sql+="&date_end="+epochSeconds;
|
||||
}
|
||||
|
||||
@ -195,6 +195,7 @@ function downloadQGISFile(product)
|
||||
if(product=='frmlocust')
|
||||
{
|
||||
let country_id='';
|
||||
let region_id='';
|
||||
let locust_type_id='';
|
||||
let date_start='';
|
||||
let date_end='';
|
||||
@ -204,6 +205,8 @@ function downloadQGISFile(product)
|
||||
let input = null;
|
||||
input = document.getElementById('filter_X1_country_id');
|
||||
if(input!=null) country_id=input.value;
|
||||
input = document.getElementById('filter_X1_region_id');
|
||||
if(input!=null) region_id=input.value;
|
||||
input = document.getElementById('filter_X1_locust_type_id');
|
||||
if(input!=null) locust_type_id=input.value;
|
||||
input = document.getElementById('filter_X1_date_start');
|
||||
@ -217,15 +220,15 @@ function downloadQGISFile(product)
|
||||
|
||||
let url='';
|
||||
if(indicator==1)
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_pods_density&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_pods_density&country_id='+country_id+'®ion_id='+region_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
if(indicator==2)
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_hoppers_density&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_hoppers_density&country_id='+country_id+'®ion_id='+region_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
if(indicator==3)
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_bands&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_bands&country_id='+country_id+'®ion_id='+region_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
if(indicator==4)
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_adults_density&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_adults_density&country_id='+country_id+'®ion_id='+region_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
if(indicator==5)
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_swarms&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
url='/api/locust/v01/QGIS?name=frmlocust_swarms&country_id='+country_id+'®ion_id='+region_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||||
|
||||
window.open(url,'_blank');
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
<script type="text/javascript" src="../resources/metadata/tree/tree.js?v=16"></script>
|
||||
|
||||
<script type="text/javascript" src="../resources/engine/popup.js?v=16"></script>
|
||||
<script type="text/javascript" src="../resources/engine/index.js?v=24"></script>
|
||||
<script type="text/javascript" src="../resources/engine/index.js?v=25"></script>
|
||||
<script type="text/javascript" src="../resources/engine/user.js?v=18"></script>
|
||||
|
||||
<style>
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<link rel="stylesheet" href="./resources/engine/index.css?v=8">
|
||||
|
||||
<script type="text/javascript" src="./resources/engine/popup.js?v=04"></script>
|
||||
<script type="text/javascript" src="./resources/index.js?v=03"></script>
|
||||
<script type="text/javascript" src="./resources/index.js?v=04"></script>
|
||||
|
||||
<link rel="stylesheet" href="./resources/engine/openlayers/ol.css" type="text/css">
|
||||
<link rel="stylesheet" href="./resources/engine/openlayers/ol-ext.css" />
|
||||
|
||||
Reference in New Issue
Block a user