[Portugal] Re: Pedido "ilegal" ao Geoserver
Gabriel Nolasco
nolasco_gabriel at yahoo.com.br
Mon Apr 26 17:37:50 EDT 2010
Olá João,
Encontro dois problemas no código que enviaste:
na instanciação do WFS protocol deves indicar o nameSpace do teu featureType;
no nome dos campos deves retirar o prefixo "peniche";
Experimenta assim:
Ext.onReady(function() {
 Â
   OpenLayers.ProxyHost = "http://localhost/cgi-bin/proxy.cgi?url=";
 Â
   var store = new GeoExt.data.FeatureStore({ Â
       fields: [
           {name: "id", type: "string"},
           {name: "toponimia", type: "string"},
       ], Â
       proxy: new GeoExt.data.ProtocolProxy({
           protocol: new OpenLayers.Protocol.WFS({
               url: "http://localhost:8080/geoserver/wfs",
               version: "1.1.0",
               featureType: "eixos_via_postgis",
            featureNS: "http://localhost:8080/geoserver/peniche",
               srsName: "EPSG:4326" Â
           })
       }),
       autoLoad: true
   });
   var gridPanel = new Ext.grid.GridPanel({
       title: "States",
       region: "center",
       viewConfig: {forceFit: true},
       store: store,
       cm: new Ext.grid.ColumnModel({
           defaults: {
               sortable: true
           },
           columns: [
               {header: "Name of the State", dataIndex: "id"},
               {header: "State ID", dataIndex: "toponimia"}
           ]
       })
   });
   var mainPanel = new Ext.Panel({
       renderTo: document.body,
       layout: "border",
       height: 450,
       width: 800,
       items: [gridPanel]
   });
});
Se continuar a não resultar diz qualquer coisa.
Cumprimentos,
Gabriel Nolasco
--- Em seg, 26/4/10, Jonas Blasques <tilakapash gmail.com> escreveu:
De: Jonas Blasques <tilakapash gmail.com>
Assunto: Re: [Portugal] Re: Pedido "ilegal" ao Geoserver
Para: portugal lists.osgeo.org
Data: Segunda-feira, 26 de Abril de 2010, 19:15
Obrigado pela resposta rápida referente à minha outra questão. Foi um
erro tipográfico muito parvo (não tinha um : no enderço http). Porém
quando o removi verifiquei que efectivamente recebia o GML como resposta
porém depois não a adiciona à página HTML. Como o código por trás é do
GeoExt + Openlayers é-me muito dificil perceber o problema.
Mais uma nota que pode ajudar: Este código faz parte do workshop OSGeo "Leveraging OGC Services with
GeoExt" adaptado aos meus dados.
Aqui está o código (apenas GeoExt JS pois não existe nenhum código HTML. à tudo criado pelo GeoExt):
Ext.onReady(function() {
        Â
         OpenLayers.ProxyHost = "http://localhost/cgi-bin/proxy.cgi?url=";
        Â
           var store = new GeoExt.data.FeatureStore({
              Â
                        fields: [
                   {name: "peniche:id", type: "string"},
                   {name: "peniche:toponimia", type: "string"},
               ],
           Â
               proxy: new GeoExt.data.ProtocolProxy({
                   protocol: new OpenLayers.Protocol.WFS({
                       url: "http://localhost:8080/geoserver/wfs",
                       version: "1.1.0",
                       featureType: "eixos_via_postgis",
                       srsName: "EPSG:4326"
                 Â
                   })
               }),
               autoLoad: true
           });
           var gridPanel = new Ext.grid.GridPanel({
               title: "States",
               region: "center",
               viewConfig: {forceFit: true},
               store: store,
               cm: new Ext.grid.ColumnModel({
                   defaults: {
                       sortable: true
                   },
                   columns: [
                       {header: "Name of the State", dataIndex: "peniche:id"},
                       {header: "State ID", dataIndex: "peniche:toponimia"}
                   ]
               })
           });
           var mainPanel = new Ext.Panel({
               renderTo: document.body,
               layout: "border",
               height: 450,
               width: 800,
               items: [gridPanel]
           });
       });
Response Body:
<wfs:featurecollection numberOfFeatures="15" timeStamp="2010-04-26T19:05:59.346+01:00" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=peniche%3Aeixos_via_postgis" xmlns:nyc_roads="http://opengeo.org/nyc_roads" xmlns:ogc="http://www.opengis.net/ogc" xmlns:tiger="http://www.census.gov" xmlns:cite="http://www.opengeospatial.net/cite" xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="http://www.openplans.org/spearfish" xmlns:ows="http://www.opengis.net/ows" xmlns:gml="http://www.opengis.net/gml" xmlns:peniche="http://localhost:8080/geoserver/peniche" xmlns:xlink="http://www.w3.org/1999/xlink">
   <gml:featuremembers>
       <peniche:eixos_via_postgis gml:id="eixos_via_postgis.525309">
           <peniche:id>
               1617719
           </peniche:id>
           <peniche:the_geom>
               <gml:multilinestring>
                   <gml:linestringmember>
                       <gml:linestring>
                           <gml:poslist>
                               -104522.35120000018 -98280.68680000032 -104499.31830000025 -98247.67889999872 -104493.11820000099 -98238.87749999814
                           </gml:poslist>
                       </gml:linestring>
                   </gml:linestringmember>
               </gml:multilinestring>
           </peniche:the_geom>
       </peniche:eixos_via_postgis>
       <peniche:eixos_via_postgis gml:id="eixos_via_postgis.525310">
           <peniche:id>
               1617731
           </peniche:id>
           <peniche:toponimia>
               PÃTIO DOM FRADIQUE
           </peniche:toponimia>
           <peniche:the_geom>
               <gml:multilinestring>
                   <gml:linestringmember>
                       <gml:linestring>
                           <gml:poslist>
                               -86869.86780000015 -105649.20809999947 -86855.81780000024 -105637.14840000152 -86838.25229999915 -105621.79619999969 -86820.7352999997 -105610.88449999999
                           </gml:poslist>
                       </gml:linestring>
                   </gml:linestringmember>
               </gml:multilinestring>
           </peniche:the_geom>
       </peniche:eixos_via_postgis>
       <peniche:eixos_via_postgis gml:id="eixos_via_postgis.525311">
           <peniche:id>
               1617732
           </peniche:id>
           <peniche:toponimia>
               PÃTIO DOM FRADIQUE
           </peniche:toponimia>
           <peniche:the_geom>
               <gml:multilinestring>
                   <gml:linestringmember>
                       <gml:linestring>
                           <gml:poslist>
                               -86820.7352999997 -105610.88449999999 -86796.99660000118 -105587.82760000147
                           </gml:poslist>
                       </gml:linestring>
                   </gml:linestringmember>
               </gml:multilinestring>
           </peniche:the_geom>
       </peniche:eixos_via_postgis>
   </gml:featuremembers>
</wfs:featurecollection>
Obrigado mais uma vez,
João
2010/4/26 Johnnycash <interlude21 gmail.com>
Professor Jorge Gustavo :)
Um abraço do seu aluno em Programação e Sig do Mestrado da Flup em SIG.
João Matos!
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Pedido-ilegal-ao-Geoserver-tp4962903p4963018.html
Sent from the OSGeo Portuguese Local Chapter mailing list archive at Nabble.com.
_______________________________________________
Portugal mailing list
Portugal lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/portugal
--
"Ajude um pouco ... já é muito"
Projecto SOSIndia http://sosindia.net
---------------------------------------------
Shoot for the moon,
even if you miss it
you will land among the stars.
- Unknown
-------------------------------------------------
What if for a moment, as an experiment,
you drop every belief that you have?
- Unknown
---------------------------------------------------------------
"We are all linked by a fabric of unseen connections. This fabric is constantly changing and evolving. This field is directly structured and influenced by our behavior and by our understanding."
âDavid Bohm, quantum physicist, 1917â1992
-----Anexo incorporado-----
_______________________________________________
Portugal mailing list
Portugal lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/portugal
-------------- próxima parte ----------
Um anexo em HTML foi limpo...
URL: http://lists.osgeo.org/pipermail/portugal/attachments/20100426/5f3ad625/attachment-0001.html
More information about the Portugal
mailing list