[Portugal] Não consigo visualizar as layers WFS...

Òscar Vidal Calbet oscarblo at gmail.com
Tue Jun 8 20:14:28 EDT 2010


 Olá,

Estou a dar os meus primeiros passos com servidores de mapas, como é de
esperar, ando um pouco perdido.
Vou tentar explicar as minhas "peripécias" destes últimos dias e assim
tratar de encontrar algumas luzes.

Estou a utilizar o seguinte ecossistema:

   - Ubuntu Server 10.4 LTS
   - sun-java6-jdk
   - Tomcat6
   - Geoserver 2.0.2 (*.war)* [Native JAI] [Native JAI ImageIO]*
   - Postgresql_8.4/Postgis_1.5.0 *[**proj-bin libproj-dev gdal-bin
   postgresql-server-dev-8.4 libgdal-dev libgeos-dev build-essential
   libxml2-dev**]*
   - GDAL

Estes são os passos mais importantes que estou a realizar, vou focar a
explicação numa das layers (linhas) para simplificar mas acontece o mesmo
com a outra layer de pontos que tenho. Qualquer detalhe que achem importante
e esteja a esquecer/omitir, não duvidem em pedir!!!:

   - Importo o shape para Postgresql_8.4/Postgis_1.5.0, utilizando o Plugin
   do QGIS.

Tabela que cria o Plugin:
CREATE TABLE eixos_via_peniche
(
gid integer NOT NULL,
"ID" integer,
"TOPONIMIA" character varying(254),
the_geom geometry,
CONSTRAINT eixos_via_peniche_pkey PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 20791)
)
WITH (
OIDS=FALSE
);
ALTER TABLE eixos_via_peniche OWNER TO postgres;

Dados que insere o Plugin na tabela geometry_columns

*17673*;"''";"*public*";"*eixos_via_peniche*";"*the_geom*";*2*;*20791*;"*
MULTILINESTRING*"

   - Publico a tabela no Geoserver 2.0.2

* *Todo corre aparentemente bem, todos os parâmetros por defeito, mmmh só
“apenas” um ***warning no momento de fazer o publish (ao fim desta mensagem
segue o texto do warning), mas depois se consegue visualizar a layer sem
problemas via WMS utilizando o Layer Preview.

   - Experimento de fazer una transacção via Demos Request.

<wfs:Transaction service="WFS" version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:topp="http://www.openplans.org/topp"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://www.openplans.org/topp
http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:eixos_via_peniche
">
<wfs:Insert>
 <topp:eixos_via_peniche>
  <topp:the_geom>
   <gml:MultiLineString srsName="
http://www.opengis.net/gml/srs/epsg.xml#4326">
    <gml:lineStringMember>
     <gml:LineString>
      <gml:coordinates decimal="." cs="," ts=" ">
494475.71056415,5433016.8189323
494982.70115662,5435041.95096618 </gml:coordinates>
     </gml:LineString>
    </gml:lineStringMember>
   </gml:MultiLineString>
  </topp:the_geom>
  <topp:TYPE>alley</topp:TYPE>
 </topp:eixos_via_peniche>
</wfs:Insert>
</wfs:Transaction>

Resultado da transacção:


<wfs:WFS_TransactionResponse version="1.0.0" xsi:schemaLocation="
http://www.opengis.net/wfs
http://192.168.58.173:8080/geoserver/schemas/wfs/1.0.0/WFS-transaction.xsd">
<wfs:InsertResult>
<ogc:FeatureId fid="eixos_via_peniche.5134"/>
</wfs:InsertResult>
<wfs:TransactionResult>
<wfs:Status>
<wfs:*SUCCESS*/>
</wfs:Status>
</wfs:TransactionResult>
</wfs:WFS_TransactionResponse>

Verifico via WMS utilizando o Layer Preview, se consegue visualizar a layer
e a linha inserida, também na tabela Postgis foi inserido o registo, tudo
parece correr bem...


   - Agora chega o momento de experimentar o mesmo utilizando Openlayers.
   Para isto modifico o ficheri wfs-t.html que o Geoserver utiliza para mostrar
   um exemplo de utilização de WFS-T.

    <script type="text/javascript">
        OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;

        var map;
        function init(){
            map = new OpenLayers.Map('map');
            var political = new OpenLayers.Layer.WMS(
                "State",
                "/geoserver/wms",
                {layers: 'topp:peniche',
                 format: 'image/png'}
            );

           *var roads = new OpenLayers.Layer.WFS(*
                *"Roads", *
                *"/geoserver/wfs",*
                *{typename: 'topp:eixos_via_peniche'},*
                *{*
                    *typename: 'eixos_via_peniche', *
                    *featureNS: 'http://www.openplans.org/topp', *
                    *extractAttributes: false*
                *}*
            *);*
            *roads.style = OpenLayers.Util.applyDefaults({strokeColor:
"#ff0000"}, *
                    *OpenLayers.Feature.Vector.style["default"]);*

            var cities = new OpenLayers.Layer.WFS(
                "Cities",
                "/geoserver/wfs",
                {typename: 'topp:pontos_interese_peniche'},
                {
                    typename: 'pontos_interese_peniche',
                    featureNS: 'http://www.openplans.org/topp',
                    extractAttributes: false
                }
            );
            cities.style = OpenLayers.Util.applyDefaults({strokeColor:
"#0000ff"},
                    OpenLayers.Feature.Vector.style["default"]);

            map.addLayers([political, roads, cities]);

            var panel = new OpenLayers.Control.Panel(
                {displayClass: 'olControlEditingToolbar'}
            );

            *var drawLine = new OpenLayers.Control.DrawFeature(*
                *roads, OpenLayers.Handler.Path,*
                *{displayClass: 'olControlDrawFeaturePath'}*
            *);*
            *drawLine.featureAdded = function(feature) {*
                *feature.layer.eraseFeatures([feature]);*
                *// cast to multilinestring*
                *feature.geometry = new OpenLayers.Geometry.MultiLineString(*
                    *feature.geometry*
                *);*
                *feature.style.strokeColor = "#ff0000";*
                *feature.state = OpenLayers.State.INSERT;*
                *feature.layer.drawFeature(feature);*
            *}*

            var drawPoint = new OpenLayers.Control.DrawFeature(
                cities, OpenLayers.Handler.Point,
                {displayClass: 'olControlDrawFeaturePoint'}
            );
            drawPoint.featureAdded = function(feature) {
                feature.layer.eraseFeatures([feature]);
                // cast to multipoint
                feature.geometry = new OpenLayers.Geometry.MultiPoint(
                    feature.geometry
                );
                feature.style.strokeColor = "#0000ff";
                feature.state = OpenLayers.State.INSERT;
                feature.layer.drawFeature(feature);
            }

            *panel.addControls(*
                *[new OpenLayers.Control.Navigation(), drawLine, drawPoint]*
            *);*

            map.addControl(panel);
            map.addControl(new OpenLayers.Control.LayerSwitcher());

            map.zoomToExtent(
                new OpenLayers.Bounds(-9.516,39.279,-9.255,39.421)
            );
        }
    </script>
  </head>  <body onload="init()">
    <a href="# <view-source:file:///C:/Users/oscar/Desktop/wfs-t2.html#>"
onclick="map.layers[1].commit();return false">Save Roads</a><br />
    <a href="# <view-source:file:///C:/Users/oscar/Desktop/wfs-t2.html#>"
onclick="map.layers[2].commit();return false">Save Cities</a>
    <div id="map"></div>
  </body></html>



   - Até agora tudo bem... tento visualizar o mapa resultante, e.., *não se
   conseguem visualizar as layers definidas como WFS*!!! só apenas a base
   layer definida como WMS. Mas, o surpreendente é que sim* se conseguem
   realizar transacções WFS-T com sucesso, inserindo novas linhas no mapa (e na
   base de dados), mas só conseguindo visualizar apenas as linhas acrescentadas
   com a interface do Openlayers*. Experimentando, observo que *só consigo
   visualizar todas as linhas via WMS utilizando o Layer Preview.*
   - Depois de todo isto decido aceder ao serviço WFS utilizando outro
   cliente, o uDig, e fico mesmo surpreendido ao ver que o resultado e
   totalmente o contrario que utilizando Openlayers, pois só consigo visualizar
   as linhas originais da layer e ano as que foram acrescentadas via WFS-T. Com
   tudo isto, insisto, e vou ao QGIS para tentar visualizar via WMS, também só
   consigo visualizar as linhas originais da layer, e voltando ao ponto
   anterior, só consigo visualizar todas linhas via WMS utilizando o* **Layer
   Preview *do geoserver.


   - Não estou seguro que seja importante, mas nos registos da *tabela
   eixos_via_peniche* é possível observar o seguinte:

*Definição da tabela*
gid integer NOT NULL,
"ID" integer,
"TOPONIMIA" character varying(254),
the_geom geometry,
CONSTRAINT eixos_via_peniche_pkey PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2),
CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 20791)

*Linhas originais*
*...*
5126;1606803;"";"010200002037510000020000005DB5847C877AFAC0284A598..."
5127;1606804;"";"010200002037510000030000005DB5847C877AFAC0284A598..."
5128;1606805;"";"010200002037510000040000007A7EFB3A6075FAC02844CF6..."
*...*
*Linhas acrescentadas mediante WFS-T*. O campo ID não contem nada e o campo
TOPONIMIA esta como ""
5130;;"";"01050000203751000001000000010200000002000000DDC32973..."
5131;;"";"01050000203751000001000000010200000002000000DDC32973..."
5133;;"";"010500002037510000010000000102000000020000003E378941..."


Até aqui chega a minha explicação, claramente omiti informações mas não
queria que fosse eterno e cansar ao pessoal...qualquer informação que
precisarem, digam!!!

Agradeço qualquer *ajuda*, critica, ponto de vista...

Desde já, muito obrigado!!!






======================================================

**warning* Oops, something went wrong...

Sorry, something unexpected happened on the server.

Here's an error report you can include in a JIRA bug
report<http://jira.codehaus.org/browse/GEOS/> about
this issue:

org.apache.wicket.WicketRuntimeException: Exception in rendering component:
[Component id = message] at
org.apache.wicket.Component.renderComponent(Component.java:2563) at
org.apache.wicket.markup.html.WebComponent.onRender(WebComponent.java:60) at
org.apache.wicket.Component.render(Component.java:2361) at
org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1298) at
org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1428) at
org.apache.wicket.Page.onRender(Page.java:1502) at
org.apache.wicket.Component.render(Component.java:2361) at
org.apache.wicket.Page.renderPage(Page.java:913) at
org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:63)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1245)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1316) at
org.apache.wicket.RequestCycle.steps(RequestCycle.java:1418) at
org.apache.wicket.RequestCycle.request(RequestCycle.java:532) at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:356) at
org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:158)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619) Caused by:
java.util.MissingResourceException: Unable to find resource:
featureTypeReloadWarning for component:
resource:tabs:panel:theList:1:content
[class=org.geoserver.web.data.resource.FeatureResourceConfigurationPanel] at
org.apache.wicket.Localizer.getString(Localizer.java:266) at
org.apache.wicket.model.StringResourceModel.getString(StringResourceModel.java:491)
at
org.apache.wicket.model.StringResourceModel.load(StringResourceModel.java:633)
at
org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:114)
at
org.apache.wicket.model.StringResourceModel$AssignmentWrapper.getObject(StringResourceModel.java:230)
at org.apache.wicket.Component.getModelObject(Component.java:1565) at
org.apache.wicket.Component.getModelObjectAsString(Component.java:1587) at
org.apache.wicket.markup.html.basic.Label.onComponentTagBody(Label.java:111)
at org.apache.wicket.Component.renderComponent(Component.java:2524) ... 72
more
-------------- próxima parte ----------
Um anexo em HTML foi limpo...
URL: http://lists.osgeo.org/pipermail/portugal/attachments/20100609/74b1a557/attachment-0001.html


More information about the Portugal mailing list