Чтение json'a
This commit is contained in:
parent
66dbc500de
commit
c3cff0b224
@ -48,14 +48,14 @@
|
||||
<div class="input-group d-flex flex-column">
|
||||
<label for="id_layer_file_input" class="file-upload-label">Выберите файл с
|
||||
расширением
|
||||
.kml, .json, .dxf</label>
|
||||
.kml, .json, .geojson, .dxf</label>
|
||||
<span>Сейчас выбран: <span id="file_path"
|
||||
style="cursor: auto; color: var(--primary);"></span></span>
|
||||
<input type="file" name="layer_file_input"
|
||||
class="form-control"
|
||||
autofocus=""
|
||||
id="id_layer_file_input" style="visibility:hidden; display: none"
|
||||
accept=".kml, .json, .dxf">
|
||||
accept=".kml, .json, .geojson, .dxf">
|
||||
{{ form.file.as_hidden }}
|
||||
</div>
|
||||
</div>
|
||||
@ -235,6 +235,10 @@
|
||||
const kml = e.target.result;
|
||||
clearVectorLayer();
|
||||
addKMLToMap(kml);
|
||||
} else if (fileExtension === "json" || fileExtension === "geojson") {
|
||||
const geojson = JSON.parse(e.target.result)
|
||||
clearVectorLayer()
|
||||
addGeoJSONToMap(geojson)
|
||||
}
|
||||
};
|
||||
reader.readAsText(file);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user