[OpenLayers-Users] Features from tiny-ows not being displayed

Toni Martínez tmartinh at gmail.com
Thu Aug 11 08:57:55 EDT 2011


Hi all,
I already have sent this problem to tinyows list but according to their
information, it seems to be a client side problem so I am forwarding it to
this list to see if I can get some support.
I am trying to implement WFS-T support to Mapserver so I am using TinyOWS
1.0. Requests are being made to server and it seems to work correctly, I am
getting a correct xml response. Anyway, features are not being displayed on
an Openlayers implementation.
Here is my tinyows.xml

<tinyows online_resource="
http://molleresdevel.eurogeotecnica.com/cgi-bin/tinyows"
        schema_dir="/usr/local/share/tinyows/schema/"
        log="/tmp/tinyows.log"
        log_level="1"
        check_schema="0">

  <pg host="172.16.3.240" user="postgres" password="postgres"
dbname="molleres2" port="5432"/>

  <metadata name="TinyOWS Server"
            title="TinyOWS Server - WFS-T Frida Service" />

  <contact name="TinyOWS Server"
           site="http://molleresdevel.eurogeotecnica.com/"
           email="tinyows-users at lists.maptools.org" />

  <layer retrievable="1"
         writable="1"
         ns_prefix="molleres"
         ns_uri="http://molleresdevel.eurogeotecnica.com/"
         schema="gis_schema"
         name="molleres_shp"
         title="molleres" />

</tinyows>

And here you can see my openlayers code which is very close to this example
http://openlayers.org/dev/examples/wfs-protocol-transactions.html

 <script type="text/javascript">
    var map, wfs;
    //OpenLayers.ProxyHost = "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 init() {

        var extent = new OpenLayers.Bounds(
            521500,15000,556500,40000
        );


        map = new OpenLayers.Map('map', {
            projection: new OpenLayers.Projection("EPSG:27573"),
            //displayProjection: new OpenLayers.Projection("EPSG:4326"),
            units: "m",
            //maxResolution: 20037508.34 / 128,
            maxResolution: 'auto',
            maxExtent: new OpenLayers.Bounds(521500, 15000, 556500, 40000),
            restrictedExtent: extent,
            controls: [
                new OpenLayers.Control.PanZoom(),
                new OpenLayers.Control.Navigation()
            ]
        });

        var resolutions =
[68.359375,34.1796875,17.08984375,8.544921875,4.2724609375,2.13623046875,1.068115234375];
// m/pixel


        var orto_andorra = new OpenLayers.Layer.WMS("Ortofoto", "
http://www.ideandorra.ad/wmsorto2003/request.aspx?", {layers:
"masaic_5m"},{isBaseLayer: true, resolutions: resolutions,
transitionEffect:'resize'} )


        var saveStrategy = new OpenLayers.Strategy.Save();



        var wfs = new OpenLayers.Layer.Vector("molleres", {
                            strategies: [new
OpenLayers.Strategy.BBOX(),saveStrategy],
                            projection: new
OpenLayers.Projection("EPSG:27573"),
                            protocol: new OpenLayers.Protocol.WFS({
                                version:       "1.1.0",
                                url:           "
http://molleresdevel.eurogeotecnica.com/cgi-bin/tinyows",
                                featureType:   "molleres_shp",
                                srsName:       "EPSG:27573",
                                featureNS:     "
http://molleresdevel.eurogeotecnica.com",
                                geometryName:  "the_geom",
                                schema:        "
http://molleresdevel.eurogeotecnica.com/cgi-bin/tinyows?service=WFS&version=1.1.0&request=DescribeFeatureType&typename=og:molleres_shp
"

                            })
                        },{
                           minResolution: 1.068115234375
                        });

        map.addLayers([orto_andorra, wfs]);

        var panel = new OpenLayers.Control.Panel({
            displayClass: 'customEditingToolbar',
            allowDepress: true
        });

        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([save, del, edit, draw]);
        map.addControl(panel);
        map.zoomToExtent(extent, true);
    }

</script>

Server is giving this response

<?xml version='1.0' encoding='UTF-8'?>
<wfs:FeatureCollection
 xmlns:molleres='http://molleresdevel.eurogeotecnica.com/'
 xmlns:wfs='http://www.opengis.net/wfs'


 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xmlns:gml='http://www.opengis.net/gml'


 xmlns:xsd='http://www.w3.org/2001/XMLSchema'
 xmlns:ogc='http://www.opengis.net/ogc'


 xmlns:xlink='http://www.w3.org/1999/xlink'
 xmlns:ows='http://www.opengis.net/ows'


 xsi:schemaLocation='http://molleresdevel.eurogeotecnica.com/
    http://molleresdevel.eurogeotecnica.com/cgi-bin/tinyows?service=WFS&amp;version=1.1.0&amp;request
<http://molleresdevel.eurogeotecnica.com/cgi-bin/tinyows?service=WFS&version=1.1.0&request>=DescribeFeatureType&amp;Typename=molleres:molleres_shp
  http://www.opengis.net/wfs


   http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
   http://www.opengis.net/gml


   http://schemas.opengis.net/gml/3.1.1/base/gml.xsd'
>
<gml:boundedBy>
  <gml:Envelope srsName="EPSG:27573"><gml:lowerCorner>524801.062500
17249.105469</gml:lowerCorner><gml:upperCorner>554734.750000
39483.292969</gml:upperCorner></gml:Envelope>


</gml:boundedBy>
  <gml:featureMember>
   <molleres:molleres_shp gml:id="molleres_shp.1">
   <molleres:codi>02153058</molleres:codi>
   <molleres:nom>Bosc de l&#39;Estall Serrer I</molleres:nom>
   <molleres:the_geom><gml:MultiSurface
srsName="EPSG:27573"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList
srsDimension="2">540193 20490 540206 20484 540203 20476 540198 20467
540195 20458 540192 20450 540188 20446 540188 20439 540184 20437
540183 20445 540184 20457 540188 20472 540191 20480 540193 20490
540193 20490</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></molleres:the_geom>


   </molleres:molleres_shp>
  </gml:featureMember>
  <gml:featureMember>
   <molleres:molleres_shp gml:id="molleres_shp.2">
   <molleres:codi>02153070</molleres:codi>
   <molleres:nom>Pleta de la Trava</molleres:nom>


   <molleres:the_geom><gml:MultiSurface
srsName="EPSG:27573"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList
srsDimension="2">541244 20657 541237 20656 541231 20667 541215 20676
541211 20683 541213 20691 541212 20696 541210 20704 541207 20714
541207 20723 541210 20730 541215 20735 541225 20737 541227 20731
541225 20722 541222 20712 541219 20703 541221 20694 541232 20689
541251 20668 541244 20657 541244
20657</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></molleres:the_geom>


   </molleres:molleres_shp>
  </gml:featureMember>
  <gml:featureMember>
   <molleres:molleres_shp gml:id="molleres_shp.3">
   <molleres:codi>02153071</molleres:codi>
   <molleres:nom>Pleta de la Trava II</molleres:nom>


   <molleres:the_geom><gml:MultiSurface
srsName="EPSG:27573"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList
srsDimension="2">541353 20618 541356 20610 541357 20603 541357 20599
541355 20598 541353 20597 541348 20592 541343 20590 541336 20590
541335 20595 541338 20602 541337 20606 541342 20612 541349 20619
541353 20618 541353
20618</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></molleres:the_geom>


   </molleres:molleres_shp>
  </gml:featureMember>
  <gml:featureMember>
   <molleres:molleres_shp gml:id="molleres_shp.4">
   <molleres:codi>02154160</molleres:codi>
   <molleres:nom>Basses de Setut IV</molleres:nom>


   <molleres:the_geom><gml:MultiSurface
srsName="EPSG:27573"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList
srsDimension="2">543025 20458 543034 20454 543040 20453 543043 20450
543050 20447 543053 20440 543062 20434 543065 20430 543074 20428
543083 20428 543086 20430 543089 20434 543091 20437 543093 20440
543096 20443 543099 20447 543101 20448 543105 20450 543107 20450
543113 20451 543114 20451 543117 20453 543121 20456 543126 20457
543128 20456 543132 20454 543135 20452 543138 20450 543145 20448
543147 20447 543152 20447 543165 20448 543175 20448 543178 20438
543178 20434 543177 20428 543176 20426 543176 20423 543175 20419
543173 20416 543170 20412 543165 20408 543162 20405 543157 20400
543155 20399 543152 20398 543150 20392 543149 20388 543147 20385
543144 20382 543132 20382 543129 20383 543124 20386 543123 20381
543120 20371 543116 20366 543111 20363 543107 20360 543106 20357
543108 20355 543112 20353 543114 20351 543111 20349 543110 20348
543108 20345 543098 20347 543095 20357 543088 20357 543082 20359
543074 20368 543073 20372 543072 20383 543069 20392 543064 20397
543064 20401 543060 20408 543054 20410 543047 20413 543041 20413
543031 20408 543021 20404 543012 20401 543010 20397 543005 20397
542996 20402 542992 20409 542990 20424 542990 20434 542995 20444
542996 20445 542996 20446 542996 20447 542997 20448 542997 20449
542997 20451 542998 20452 542998 20452 542999 20453 543000 20454
543001 20454 543002 20455 543003 20455 543004 20456 543005 20456
543015 20455 543022 20459 543025 20458 543025
20458</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></molleres:the_geom>


   </molleres:molleres_shp>
  </gml:featureMember>
  <gml:featureMember>
   <molleres:molleres_shp gml:id="molleres_shp.5">
   <molleres:codi>02154158</molleres:codi>
   <molleres:nom>Basses de Setut II</molleres:nom>


   <molleres:the_geom><gml:MultiSurface
srsName="EPSG:27573"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList
srsDimension="2">543209 20372 543215 20373 543221 20373 543229 20373
543234 20371 543240 20365 543246 20360 543246 20353 543245 20346
543244 20341 543247 20336 543251 20330 543254 20324 543259 20317
543262 20314 543258 20312 543253 20316 543247 20323 543241 20328
543235 20335 543234 20345 543240 20346 543240 20352 543238 20358
543229 20360 543224 20363 543208 20368 543209 20372 543209
20372</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></molleres:the_geom>


   </molleres:molleres_shp>
  </gml:featureMember>
  <gml:featureMember>
   <molleres:molleres_shp gml:id="molleres_shp.6">
   <molleres:codi>02154157</molleres:codi>
   <molleres:nom>Basses de Setut I</molleres:nom>


   <molleres:the_geom><gml:MultiSurface
srsName="EPSG:27573"><gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList
srsDimension="2">543261 20304 543262 20298 543263 20294 543263 20290
543261 20281 543257 20278 543256 20270 543259 20260 543258 20251
543254 20244 543254 20245 543249 20240 543245 20236 543244 20233
543245 20228 543246 20221 543244 20217 543242 20211 543239 20209
543231 20213 543225 20223 543230 20234 543232 20243 543225 20248
543217 20255 543228 20252 543235 20252 543240 20257 543244 20265
543246 20272 543252 20279 543257 20287 543259 20295 543261 20304
543261 20304</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember></gml:MultiSurface></molleres:the_geom>



....

So as I said, it seems to get a proper response.

Any help will be sincerely appreciated.

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110811/1139ba4a/attachment-0001.html


More information about the Users mailing list