[OpenLayers-Users] wfs reprojection (epsg4326,epsg900913)

truongxuan quang truongxuanquang at yahoo.com
Mon Jan 30 10:31:44 EST 2012


Hello list

Many thanks for all very useful questions and answers during time when I was in this list. I used geoserver with all layers in epsg:4326 , the base map I used google layer in epsg: 900913,  
the problem is WFS didn't appear to my map although Gird which bind with wfs it displayed all the data , If I remove maxExtent: bounds1,   wfs map layer could appear to the map, I try to reprojection for wfs layer but it could not done. If someone have any experiences in this problem please help me.
Bellow one is some related functions to my problem


var bounds1 = new OpenLayers.Bounds( 
                    11131950, 2273050,
                    12245130,  2875730);

var geographic = new OpenLayers.Projection("EPSG:4326");
       var mercator = new OpenLayers.Projection("EPSG:900913");
mapOptions = {
maxExtent: bounds1, 
minResolution: "auto",
maxResolution: 'auto',
   projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
//projection: "EPSG:4326",
numZoomLevels: 20 ,
units: "m",
allOverlays: false
};

var protocol=new OpenLayers.Protocol.WFS({
srsName: "EPSG:4326"
,url: "http://localhost:8083/geoserver/wfs"   
,featureType: "VN_provinces"
,featureNS: "http://www.openplans.org/topp"
});
 var ddBounds = new OpenLayers.Bounds(

               100,20,110,25
            );

var form_Quang_1=new GeoExt.form.FormPanel({ 
      region: "center",
  id: "form_Quang_1",
  //title: "Search by Population",
   title: 'Search by Population'+'&#160&#160&#160&#160&#160<img src="./img/info.png" style="line-height:19px;font-height:10px;vertical-align:bottom" TITLE="Search for Provinces having their population in interval of two values (min and max of population). The results will appeare on the grid responsed with Map, you could turn on/off Search Map by select on/off in Search windows below or Tree(Map Layers/Openlayers) above"/>',
  layout: "fit",
  
collapsible: true,
collapsed: true,
split: true,
  autoScroll: true,
  bodyStyle: "padding:10px;",
  protocol: protocol,
  items: [
{
  xtype:'textfield',
  id: "textfield_11",                   
  width: 75,
  //height: 30,  
  name: "Danso__ge",
  allowBlank: false,
  value: '0',
  fieldLabel: ">="
  },{
  xtype:'textfield',
  id: "textfield_12",                   
  width: 75,
  //height: 30,  
  name: "Danso__le",
  allowBlank: false,
   value: '10000000',
  fieldLabel: "<="
  },{
xtype: 'button',
text: '<span style="font-weight:bold; "color:red"> |-Run-| </span>',
//anchor: '100%',
handler: function(){
var mypanel = Ext.getCmp('grid_Quang');
mypanel.expand();
form_Quang_1.search();
}},
{
xtype: 'button',
text: '<span style="font-weight:bold; "color:red"> |-Remove Search Map-|</span>',
anchor: '100%',
handler: function(){
for(var i=0; i<map.layers.length ; i++){
if(map.layers[i].name==="Search_map"){
map.removeLayer(vec_Layer)
}
}
}
}  
],
listeners: {
 actioncomplete: function(form, action) {
               var features = action.response.features;
                store_Quang.loadData(features);
                vm=map.getLayersByName("Search_map");
                if(vm.length===0){
                 
                    map.addLayer(vec_Layer);
store_Quang.bind(vec_Layer);
                    select_Quang.bind(vec_Layer);
                   map.zoomToExtent(
                ddBounds.transform(map.displayProjection, map.getProjectionObject())
            );
                }
            }

        },
        keys: [{ key: [Ext.EventObject.ENTER],
            handler: function() {
var mypanel = Ext.getCmp('grid_Quang');
 mypanel.expand();
                form_Quang_1.search();
            }
        }]

    });

Many Thanks 

T.X.Q
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120130/c69cbb0a/attachment-0001.html


More information about the Users mailing list