[OpenLayers-Users] WFS map from shapefiles

sunny74 sb.ray at hotmail.com
Thu Mar 25 01:48:21 EDT 2010


Dear Friends,

I am trying to create and display a WFS map but I am getting various
errors.The map is not getting displayed.

The code which displays map is as follows:

function init1() {
              // srs=EPSG:4326,bounds
             var options = {
           projection: "epsg:4326",
           numZoomLevels: 18,
           maxExtent: new OpenLayers.Bounds(67.440106, 17.379867, 78.390250,
25.122977),
           units : "dd"
          }

              map = new OpenLayers.Map('<%=map.ClientID%>', options);
              layer = new OpenLayers.Layer.WFS("OpenLayers WFS",
"http://localhost:9000/cgi-bin/mapserv.exe?map=d:/ms4w/apache/cgi-bin/Shape/wfs_map.map",
{ typename: 'STATE' });

              map.addLayers([layer]);
              //map.zoomToMaxExtent();
             // map.setCenter(new OpenLayers.LonLat(73.25, 20.35), 6);
              map.addControl(new OpenLayers.Control.LayerSwitcher());

          }

I am getting errors for the line map.setCenter(new OpenLayers.LonLat(73.25,
20.35), 6);
It is going to a function called IsvalidLonlat in the Map.js and there the
lonlat is coming as Invalid.
Similarly I am getting error for map.zoomToMaxExtent();

My map file is as given below:

# Map file created from QGIS project file D:/QGIS/newwr.qgs
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
  NAME wfs_map.map
  STATUS ON
  # Map image size
  SIZE 600 600
  UNITS dd
  EXTENT 67.440106 17.379867 78.390250 25.122977
  FONTSET 'D:\ms4w\Apache\cgi-bin\Shape\font.txt'
 #SHAPEPATH 'D:\ms4w\Apache\cgi-bin\Shape' 
  IMAGECOLOR 192 192 192
  END
    # Legend
 
  
  # Web interface definition. Only the template parameter
  # is required to display a map. See MapServer documentation
  WEB
    # Set IMAGEPATH to the path where MapServer should
    # write its output.
    IMAGEPATH "/ms4w/tmp/ms_tmp/"

    # Set IMAGEURL to the url that points to IMAGEPATH
    # as defined in your web server configuration
    IMAGEURL "/ms_tmp/"

    # WFS server settings
    METADATA
      'wfs_title'           'wfs_map.map'
      'wfs_onlineresource' 
'http://127.0.0.1:9000/cgi-bin/mapserv.exe?map=wfs_map.map&'
      'wfs_srs'             'EPSG:42304 EPSG:42101 EPSG:4269 EPSG:4326'
    END

    #Scale range at which web interface will operate
    # Template and header/footer settings
    # Only the template parameter is required to display a map. See
MapServer documentation
  END

  LAYER
    NAME "STATE"
    TYPE POLYGON
    METADATA
     "wfs_title"    "STATE" ## REQUIRED
     "gml_featureid" "1" ## REQUIRED
     "gml_include_items" "all"
    END
    STATUS ON
    #TRANSPARENCY 100
    DATA "D:/ms4w/Apache/cgi-bin/Shape/STATE.shp"
    
    DUMP TRUE 
    CLASS
       NAME 'STATE' 
       STYLE
        OUTLINECOLOR 0 0 0
         COLOR 255 255 127
       END
        TEMPLATE "ttt_query.html"
    END
  END

  
END

Why I am getting these errors?
How to properly display a map using WFS?

Thanks for your efforts.
-- 
View this message in context: http://n2.nabble.com/WFS-map-from-shapefiles-tp4795937p4795937.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list