Есть ли возможность реализовать редактирование shape через браузер?
Добавлено: 24 июн 2018, 19:32
Есть ли такие сервисы?
Если нет, то может есть API такие у QGIS или других?
Если нет, то может есть API такие у QGIS или других?
Геоинформационные системы (ГИС) и Дистанционное зондирование Земли
https://gis-lab.info/forum/
Допустим я преобразую shp в geojson, но как мне его отредактировать? В canvas?bim2010 писал(а): ↑24 июн 2018, 19:54shp2geojson.js - https://github.com/gipong/shp2geojson.js
https://gis.stackexchange.com/questions ... enlayers-3
На карте элементы не отображаются.
Код: Выделить всё
$(document).ready(function() {
function loadShpZip() {
var epsg = ($('#epsg').val() == '') ? 4326 : $('#epsg').val(),
encoding = ($('#encoding').val() == '') ? 'UTF-8' : $('#encoding').val();
if(file.name.split('.')[1] == 'zip') {
if(file) $('.dimmer').addClass('active');
loadshp({
url: file,
encoding: encoding,
EPSG: epsg
}, function(data) {
//document.write(JSON.stringify(data));
//console.log(JSON.stringify(data));
var image = new ol.style.Circle({
radius: 5,
fill: null,
stroke: new ol.style.Stroke({color: 'red', width: 10})
});
var styles = {
'Point': new ol.style.Style({
image: image
}),
'LineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 1
})
}),
'MultiLineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 1
})
}),
'MultiPoint': new ol.style.Style({
image: image
}),
'MultiPolygon': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'yellow',
width: 1
}),
fill: new ol.style.Fill({
color: 'rgba(255, 255, 0, 0.1)'
})
}),
'Polygon': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
lineDash: [4],
width: 3
}),
fill: new ol.style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
}),
'GeometryCollection': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'magenta',
width: 2
}),
fill: new ol.style.Fill({
color: 'magenta'
}),
image: new ol.style.Circle({
radius: 10,
fill: null,
stroke: new ol.style.Stroke({
color: 'magenta'
})
})
}),
'Circle': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'red',
width: 2
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.2)'
})
})
};
var styleFunction = function(feature) {
return styles[feature.getGeometry().getType()];
};
var vectorSource = new ol.source.Vector({
features: (new ol.format.GeoJSON()).readFeatures(JSON.stringify(data))
});
var vectorLayer = new ol.layer.Vector({
source: vectorSource,
style: styleFunction
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
vectorLayer
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
});
}
}
$("#file").change(function(evt) {
file = evt.target.files[0];
if(file.size > 0) {
loadShpZip();
}
});
$('#addZipfile').click(function() {
$('.shp-modal').toggleClass('effect');
$('.overlay').toggleClass('effect');
$('#wrap').toggleClass('blur');
});
});