Как это сделать подскажите пожалуйста, что для этого нужно знать?
Насколько я понимаю вот вся информация о созданном объекте geomoose

Геоинформационные системы (ГИС) и Дистанционное зондирование Земли
Спасибо. Я бы хотел использовать geomoose как GUI и в базу сохранять объекты, которые пользователь нарисует, и потом востанавливать эти объекты из базы. Как Вы думаете можно ли такое реализовать с помощью tinyOWS?Denis Rykov писал(а):Только имейте ввиду, что TinyOWS работает только с PostGIS-ом и никакого GUI у него нет, я как-то рассказывал про него на гисконфе.
Спасибо. Попробовал установить tinyows но возникли сложности, скорее всего, я не правильно установил postgis. Буду переделывать. Следую этому гайду - http://docs.geomoose.org/2.8/docs/vecto ... setup.html.Denis Rykov писал(а):Да можно.
Код: Выделить всё
<tinyows online_resource="http://localhost/mapserver/cgi-bin/tinyows"
schema_dir="/usr/local/tinyows/schema/"
check_schema="0"
log="/tmp/tinyows.log"
log_level="15"
check_valid_geom="0">
<metadata name="TinyOWS Server"
title="TinyOWS Server - Demo Service" />
<pg host="localhost" user="gis" password="super_gis" dbname="gis" port="5432" />
<layer retrievable="1"
writable="1"
server="http://localhost/"
ns_prefix="census"
ns_uri="http://localhost/geomoose/census_places"
name="census_places"
title="Census Places" />
</tinyows>
Код: Выделить всё
<map-source name="census_cities" type="wfs">
<style type="stylemap"><![CDATA[
{
"strokeColor" : "#00ff00",
"label" : "${namelsad10}"
}
]]></style>
<url>/mapserver/cgi-bin/tinyows</url>
<attribute name="geoid10" type="user" label="ID:" default-value="27999"/>
<attribute name="namelsad10" type="user" label="Name:"/>
<feature-namespace>http://localhost/geomoose/census_places</feature-namespace>
<feature-type>census_places</feature-type>
<geometry-name>wkb_geometry</geometry-name>
<schema><![CDATA[http://localhost/mapserver/cgi-bin/tinyows?service=WFS&version=1.1.0&request=DescribeFeatureType&typename=census:census_places]]></schema>
<popup-template><![CDATA[
<div style="font-size: 1.5em">${namelsad}</div>
Area of Land: ${aland}<br>
Area of Water: ${awater}<br>
<br>
<a href="https://www.census.gov/2010census/popmap/ipmtext.php?fl=${statefp}:${geoid}" target="_blank">Census Info Page</a>
]]></popup-template>
</map-source>
Большое спасибо. Вы правы.Denis Rykov писал(а):Вы создали базу данных gis и добавили в неё экстеншен PostGIS?
Код: Выделить всё
<map-source name="census_cities" type="wfs">
<style type="stylemap"><![CDATA[
{
"strokeColor" : "#00ff00",
"label" : "${namelsad10}"
}
]]></style>
<url>/mapserver/cgi-bin/tinyows</url>
<attribute name="geoid10" type="user" label="ID:" default-value="27999"/>
<attribute name="namelsad10" type="user" label="Name:"/>
<feature-namespace>http://localhost/geomoose/census_places</feature-namespace>
<feature-type>census_places</feature-type>
<geometry-name>wkb_geometry</geometry-name>
<schema><![CDATA[http://localhost/mapserver/cgi-bin/tinyows?service=WFS&version=1.1.0&request=DescribeFeatureType&typename=census:census_places]]></schema>
<popup-template><![CDATA[
<div style="font-size: 1.5em">${namelsad}</div>
Area of Land: ${aland}<br>
Area of Water: ${awater}<br>
<br>
<a href="https://www.census.gov/2010census/popmap/ipmtext.php?fl=${statefp}:${geoid}" target="_blank">Census Info Page</a>
]]></popup-template>
</map-source>
Код: Выделить всё
<html>
<head>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script src="../lib/OpenLayers.js"></script>
<style>
#map {
width: 800px;
height: 500px;
float: left;
border: 1px solid #ccc;
}
#message {
position: relative;
left: 5px;
}
#docs {
float: left;
}
.customEditingToolbar {
float: right;
right: 0px;
height: 30px;
width: 200px;
}
.customEditingToolbar div {
float: right;
margin: 5px;
width: 24px;
height: 24px;
}
.olControlNavigationItemActive {
background-image: url("../theme/default/img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -103px -23px;
}
.olControlNavigationItemInactive {
background-image: url("../theme/default/img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -103px -0px;
}
.olControlDrawFeaturePolygonItemInactive {
background-image: url("../theme/default/img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -26px 0px;
}
.olControlDrawFeaturePolygonItemActive {
background-image: url("../theme/default/img/editing_tool_bar.png");
background-repeat: no-repeat;
background-position: -26px -23px ;
}
.olControlModifyFeatureItemActive {
background-image: url(../theme/default/img/move_feature_on.png);
background-repeat: no-repeat;
background-position: 0px 1px;
}
.olControlModifyFeatureItemInactive {
background-image: url(../theme/default/img/move_feature_off.png);
background-repeat: no-repeat;
background-position: 0px 1px;
}
.olControlDeleteFeatureItemActive {
background-image: url(../theme/default/img/remove_point_on.png);
background-repeat: no-repeat;
background-position: 0px 1px;
}
.olControlDeleteFeatureItemInactive {
background-image: url(../theme/default/img/remove_point_off.png);
background-repeat: no-repeat;
background-position: 0px 1px;
}
</style>
<script src="tinyows.js"></script>
</head>
<body onload="init()">
<h1 id="title">WFS Transaction Example, (TinyOWS ans OpenLayers)</h1>
<div id="tags"></div>
<p id="shortdesc">
Shows the use of the WFS Transactions (WFS-T).
Parks of Osnabruck (Frida).
<br />
Base layers is OpenStreetMap from Omniscale WMS Server.
</p>
<div id="map"></div>
<div id="message"></div>
<div id="docs">
<p>
The WFS protocol allows for creation of new features and
reading, updating, or deleting of existing features.
</p>
<p>
Use the tools to create, modify, and delete (in order from left
to right) features. Use the save tool (picture of a disk) to
save your changes. Use the navigation tool (hand) to stop
editing and use the mouse for map navigation.
</p>
<p>
See the <a href="tinyows.js" target="_blank">
wfs-protocol-transactions.js source</a> to see how this is done.
</p>
</div>
</body>
</html>
Код: Выделить всё
var map, wfs;
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
var DeleteFeature = OpenLayers.Class(OpenLayers.Control, {
initialize: function(layer, options) {
OpenLayers.Control.prototype.initialize.apply(this, [options]);
this.layer = layer;
this.handler = new OpenLayers.Handler.Feature(
this, layer, {click: this.clickFeature}
);
},
clickFeature: function(feature) {
// if feature doesn't have a fid, destroy it
if(feature.fid == undefined) {
this.layer.destroyFeatures([feature]);
} else {
feature.state = OpenLayers.State.DELETE;
this.layer.events.triggerEvent("afterfeaturemodified",
{feature: feature});
feature.renderIntent = "select";
this.layer.drawFeature(feature);
}
},
setMap: function(map) {
this.handler.setMap(map);
OpenLayers.Control.prototype.setMap.apply(this, arguments);
},
CLASS_NAME: "OpenLayers.Control.DeleteFeature"
});
function showMsg(szMessage) {
document.getElementById("message").innerHTML = szMessage;
setTimeout(
"document.getElementById('message').innerHTML = ''",2000);
}
function showSuccessMsg(){
showMsg("Transaction successfully completed");
};
function showFailureMsg(){
showMsg("An error occurred while operating the transaction");
};
function init() {
map = new OpenLayers.Map('map', {
projection: new OpenLayers.Projection("EPSG:31467"),
units: "m",
maxResolution: "auto",
maxExtent: new OpenLayers.Bounds(3427000,5788000,3444000,5800000),
controls: [
new OpenLayers.Control.PanZoom()
]
});
var osm = new OpenLayers.Layer.WMS(
"OSM by Omniscale WMS",
"http://osm.omniscale.net/proxy/service",
{layers: 'osm', format: 'image/jpeg'},
{projection:"EPSG:31467", units: "m", maxResolution: "auto", maxExtent: new OpenLayers.Bounds(3427000,5788000,3444000,5800000)}
);
var saveStrategy = new OpenLayers.Strategy.Save();
saveStrategy.events.register("success", '', showSuccessMsg);
saveStrategy.events.register("fail", '', showFailureMsg);
wfs = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
projection: new OpenLayers.Projection("EPSG:31467"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:31467",
url: "http://127.0.0.1/cgi-bin/tinyows",
featureNS : "http://www.tinyows.org/",
featureType: "frida",
geometryName: "geom",
schema: "http://127.0.0.1/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.1.0&typename=tows:frida"
})
});
map.addLayers([osm, wfs]);
var panel = new OpenLayers.Control.Panel(
{'displayClass': 'customEditingToolbar'}
);
var navigate = new OpenLayers.Control.Navigation({
title: "Pan Map"
});
var draw = new OpenLayers.Control.DrawFeature(
wfs, OpenLayers.Handler.Polygon,
{
title: "Draw Feature",
displayClass: "olControlDrawFeaturePolygon",
multi: true
}
);
var edit = new OpenLayers.Control.ModifyFeature(wfs, {
title: "Modify Feature",
displayClass: "olControlModifyFeature"
});
var del = new DeleteFeature(wfs, {title: "Delete Feature"});
var save = new OpenLayers.Control.Button({
title: "Save Changes",
trigger: function() {
if(edit.feature) {
edit.selectControl.unselectAll();
}
saveStrategy.save();
},
displayClass: "olControlSaveFeatures"
});
panel.addControls([navigate, save, del, edit, draw]);
panel.defaultControl = navigate;
map.addControl(panel);
map.zoomToMaxExtent();
}
Сейчас этот форум просматривают: нет зарегистрированных пользователей и 5 гостей
© GIS-Lab и авторы, 2002-2017. При использовании материалов сайта, ссылка на GIS-Lab и авторов обязательна. Содержание материалов - ответственность авторов (подробнее).