открыть wfs слой, опцбликованный через tinyows, с помощью OL
Добавлено: 13 май 2014, 15:42
Подскажите как открыть собственный wfs слой, опубликованный через tinyows, с помощью библиотеки openlaers?
Геоинформационные системы (ГИС) и Дистанционное зондирование Земли
https://gis-lab.info/forum/
Код: Выделить всё
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>Accessible Custom Click Control</title>
<script src="../lib/Firebug/firebug.js"></script>
<script src="../lib/OpenLayers.js"></script>
<script type="text/JavaScript">
function init(){
map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Vector('vod', {strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.WFS({
version: '1.1.0',
srsName: 'EPSG:4326',
url: 'http://localhost/cgi-bin/tinyows.exe',
featurePrefix: 'my',
featureType: 'vod',
featureNS: 'http://www.tinyows.org',
geometryName: "geom",
schema: "http://localhost/cgi-bin/tinyows.exe?service=WFS&version=1.1.0&request=DescribeFeatureType&Typename=my:vod",}),
});
map.addLayers([layer]);
console.log(layer);
}
</script>
</head>
<body onload="init()">
<h1 id="title">My wfs</h1>
<div style="width:600px; height:600px" id="map"></div>
</body>
</html>
Код: Выделить всё
[Wed May 14 12:06:56 2014] [SQL] SELECT substr(postgis_full_version(), 10, 5)
[Wed May 14 12:06:56 2014] [SQL] SELECT DISTINCT f_table_schema, f_table_name FROM geometry_columns
[Wed May 14 12:06:56 2014] [SQL] SELECT DISTINCT f_table_schema, f_table_name FROM geography_columns
[Wed May 14 12:06:56 2014] [SQL] SELECT srid, f_geometry_column FROM geometry_columns WHERE f_table_schema='public' AND f_table_name='vod'
[Wed May 14 12:06:56 2014] [SQL] SELECT * FROM spatial_ref_sys WHERE srid=4326 AND proj4text like '%%units=m%%'
[Wed May 14 12:06:56 2014] [SQL] SELECT a.attname AS field, t.typname AS type FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n WHERE n.nspname = 'public' AND c.relname = 'vod' AND c.relnamespace = n.oid AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid
[Wed May 14 12:06:56 2014] [SQL] SELECT type from geometry_columns where f_table_schema='public' and f_table_name='vod' and f_geometry_column='geom';
[Wed May 14 12:06:56 2014] [SQL] SELECT a.attname AS field FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n WHERE n.nspname = 'public' AND c.relname = 'vod' AND c.relnamespace = n.oid AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND a.attnotnull = 't' AND a.atthasdef='f'
[Wed May 14 12:06:56 2014] [SQL] SELECT c.column_name FROM information_schema.constraint_column_usage c, pg_namespace n WHERE n.nspname = 'public' AND c.table_name = 'vod' AND c.constraint_name = (SELECT c.conname FROM pg_class r, pg_constraint c, pg_namespace n WHERE r.oid = c.conrelid AND relname = 'vod' AND r.relnamespace = n.oid AND n.nspname = 'public' AND c.contype = 'p')
[Wed May 14 12:06:56 2014] [SQL] SELECT a.attnum FROM pg_class c, pg_attribute a, pg_type t, pg_namespace n WHERE a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid AND n.nspname='public' AND c.relname='vod' AND a.attname='gid'
[Wed May 14 12:06:56 2014] [SQL] SELECT pg_get_serial_sequence('public."vod"', 'gid');
Код: Выделить всё
schema: "http://localhost/cgi-bin/tinyows.exe?service=WFS&version=1.1.0&request=DescribeFeatureType&Typename=my:vod",
Код: Выделить всё
<html>
<head>
<title>My Map</title>
<script src="http://openlayers.org/dev/OpenLayers.js"></script>
<script>
function init() {
var options = {
div: "mapid",
projection: "EPSG:3857"
};
var map = new OpenLayers.Map(options);
var osm = new OpenLayers.Layer.OSM()
railway_station = new OpenLayers.Layer.Vector("Buildings", {
strategies: [
new OpenLayers.Strategy.BBOX()
],
protocol: new OpenLayers.Protocol.WFS({
version: "1.0.0",
url: "http://10.22.0.9/cgi-bin/wfs",
featureType: "railway_station",
geometryName: "wkb_geometry"
}),
projection: 'EPSG:4326'
});
var extent = [3322236.017526,8366084.2704585,3418852.421265,8395053.9041745];
map.addLayers([osm, railway_station]);
map.zoomToExtent(extent);
var ls = new OpenLayers.Control.LayerSwitcher()
map.addControl(ls);
}
</script>
</head>
<body>
<body onload="init()">
<div id="mapid" style="width:100%; height:100%"></div>
</body>
</html>