Merge remote-tracking branch 'origin/master'

This commit is contained in:
bob 2018-12-28 10:22:51 +08:00
commit 13cc922f9d
4 changed files with 25 additions and 4 deletions

View File

@ -26,4 +26,5 @@
margin: 10px 0 20px 0; margin: 10px 0 20px 0;
border-left: 6px solid #ccc; border-left: 6px solid #ccc;
min-height: 40px; min-height: 40px;
word-break: break-all;
} }

View File

@ -24,10 +24,23 @@ function initForm() {
var $resultContainer = $('#js-disaster-result-container'); var $resultContainer = $('#js-disaster-result-container');
var $resultContent = $('#js-disaster-result-content'); var $resultContent = $('#js-disaster-result-content');
var $form = $('#js-disaster-form'); var $form = $('#js-disaster-form');
var $calc = $form.find('#prevent')
$form.submit(function (evt) { $form.submit(function (evt) {
evt.preventDefault(); evt.preventDefault();
var path = '';
var calc = Number($calc.val()) === 1;
if (calc) {
path = 'calc_prevent_impact/'
}
if (!calc && MapBase.hasActiveLayer()) {
path = 'hailstones/'
}
if (!calc && !MapBase.hasActiveLayer()) {
path = 'calc_hailstones_impact/'
}
if (!FileInput.isValid()) { if (!FileInput.isValid()) {
return return
} }
@ -37,7 +50,7 @@ function initForm() {
$resultContent.empty(); $resultContent.empty();
$.ajax({ $.ajax({
url: CONFIG.ajaxBase + '/disaster/' + (MapBase.hasActiveLayer() ? 'hailstones/' : 'calc_hailstones_impact/'), url: CONFIG.ajaxBase + '/disaster/' + path,
data: new FormData(this), data: new FormData(this),
method: 'post', method: 'post',
contentType: false, contentType: false,

View File

@ -48,6 +48,12 @@
<option value="0"></option> <option value="0"></option>
</select> </select>
<label for="prevent">防雹点</label>
<select name="prevent" class="sel" id="prevent">
<option value="0"></option>
<option value="1"></option>
</select>
<label for="file-path">数据文件</label> <label for="file-path">数据文件</label>
<button file-button type="button">选择文件</button> <button file-button type="button">选择文件</button>
@ -64,13 +70,13 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="result-container" id="js-disaster-result-container"> <div class="result-container" id="js-disaster-result-container">
<p>算结果</p> <p>受灾面积统计:</p>
<div id="js-disaster-result-content"></div> <div id="js-disaster-result-content"></div>
</div> </div>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div id="map""></div> <div id="map"></div>
</div> </div>
{% if is_paginated %} {% if is_paginated %}
<div class="col-md-12"> <div class="col-md-12">

View File

@ -51,7 +51,8 @@ def intersection(gdf1, gdf2):
index_gdf1 += 1 index_gdf1 += 1
gdf = GeoDataFrame(geometry=geo_list, crs=gdf1.crs) gdf = GeoDataFrame(geometry=geo_list, crs=gdf1.crs)
gdf['county'] = county if county and len(county) > 0:
gdf['county'] = county
# print(gdf.head()) # print(gdf.head())
return gdf return gdf