I saw 
http://gwt-openlayers.hg.sourceforge.net/hgweb/gwt-openlayers/gwt-openlayers/file/c26877cf76a4/showcase/src/org/gwtopenmaps/demo/openlayers/client/examples/vector/BasicWFS.java
http://gwt-openlayers.hg.sourceforge.net/hgweb/gwt-openlayers/gwt-openlayers/file/c26877cf76a4/showcase/src/org/gwtopenmaps/demo/openlayers/client/examples/vector/BasicWFS.java
  

and wrote this code:


package com.mycompany.project.client;

import org.gwtopenmaps.openlayers.client.LonLat;
import org.gwtopenmaps.openlayers.client.MapOptions;
import org.gwtopenmaps.openlayers.client.MapWidget;
import org.gwtopenmaps.openlayers.client.OpenLayers;
import org.gwtopenmaps.openlayers.client.control.LayerSwitcher;
import org.gwtopenmaps.openlayers.client.control.PanZoomBar;
import org.gwtopenmaps.openlayers.client.layer.Layer;
import org.gwtopenmaps.openlayers.client.layer.TransitionEffect;
import org.gwtopenmaps.openlayers.client.layer.Vector;
import org.gwtopenmaps.openlayers.client.layer.VectorOptions;
import org.gwtopenmaps.openlayers.client.layer.WMS;
import org.gwtopenmaps.openlayers.client.layer.WMSOptions;
import org.gwtopenmaps.openlayers.client.layer.WMSParams;
import org.gwtopenmaps.openlayers.client.protocol.WFSProtocol;
import org.gwtopenmaps.openlayers.client.protocol.WFSProtocolOptions;
import org.gwtopenmaps.openlayers.client.strategy.BBoxStrategy;
import org.gwtopenmaps.openlayers.client.strategy.Strategy;
import org.gwtopenmaps.openlayers.client.util.JObjectArray;
import org.gwtopenmaps.openlayers.client.util.JSObject;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.RootPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class ImageViewer implements EntryPoint {
        private MapWidget mapWidget;
        private WMS wmsLayer;
        public static final String WMS_URL = 
"http://labs.metacarta.com/wms/vmap0";;

        public void onModuleLoad() {
                // // let's create map options
                 MapOptions mapOptions = new MapOptions();
                 mapOptions.setControls(new JObjectArray(new JSObject[] {}));
                 mapOptions.setNumZoomLevels(16);
                 mapOptions.setProjection("EPSG:4326");
                //
                // let's create map widget and map objects 
                 mapWidget = new MapWidget( "350px","350px", mapOptions);
                
                // Defining a WMSLayer and adding it to a Map
                WMSParams wmsParams = new WMSParams();
                wmsParams.setFormat("image/png");
                wmsParams.setLayers("basic");
                wmsParams.setStyles("");

                WMSOptions wmsLayerParams = new WMSOptions();
                wmsLayerParams.setUntiled();
                wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);

                wmsLayer = new WMS("Basic WMS", WMS_URL, wmsParams, 
wmsLayerParams);

                // set a proxyHost
                OpenLayers.setProxyHost("gwtOpenLayersProxy?targetUrl=");
                // String proxyHost = OpenLayers.getProxyHost();

                // Defining a WFS and adding it to the map
                // Define a WFS with WFS protocol
                WFSProtocolOptions wfsProtocolOptions = new 
WFSProtocolOptions();
                
wfsProtocolOptions.setUrl("http://demo.opengeo.org/geoserver/wfs";);
                
                wfsProtocolOptions.setFeatureType("tasmania_roads");
                
wfsProtocolOptions.setFeatureNameSpace("http://www.openplans.org/topp";);

                WFSProtocol wfsProtocol = new WFSProtocol(wfsProtocolOptions);

                VectorOptions vectorOptions = new VectorOptions();
                vectorOptions.setProtocol(wfsProtocol);
                vectorOptions.setStrategies(new Strategy[] { new BBoxStrategy() 
});
                Vector wfsLayer = new Vector("wfsExample", vectorOptions);

                mapWidget.getMap().addLayers(new Layer[] { wmsLayer, wfsLayer 
});
                mapWidget.getMap().addControl(new PanZoomBar());
                mapWidget.getMap().addControl(new LayerSwitcher());
                mapWidget.getMap().setCenter(new LonLat(146.7, -41.8), 6);

                // eventually add the map widget to div:map
                DockPanel dockPanel = new DockPanel();
                dockPanel.add(mapWidget, DockPanel.CENTER);
                dockPanel.setBorderWidth(1);
                RootPanel.get().add(dockPanel);

        }
}


But I don't see tasmania_roads layer.. Why?
http://n2.nabble.com/file/n4935723/GIS_Prj2.zip GIS_Prj2.zip 
http://n2.nabble.com/file/n4935723/untitled.png 

-- 
View this message in context: 
http://n2.nabble.com/gwtOpenLayersProxy-problem-tp4935723p4935723.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to