[OpenLayers-Users] getting Feature Info data directly from .shpfiles

sunny74 sb.ray at hotmail.com
Sat Mar 20 16:17:14 EDT 2010


Hi Arnd,

Thanks for our reply.

You have understood my question rightly.
I want to display the attributes of a layer(one layer is one .shp file) in a
pop up using openlayers.This 
we get to see if the .shp file is converted to a DB table.

1) You have given some mapfile code.But I am not sure exactly where to
insert within the layer definition.
So if a typical layer of mine is as given below can u pls tell me where I
have to insert the mapfile statements.

LAYER
    NAME 'STATE'
    TYPE POLYGON
    DATA 'C:\ms4w\Apache\cgi-bin\Shape\STATE.shp'
    METADATA
      'wms_title' 'STATE'
    END
    STATUS DEFAULT
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    ''
    END
    CLASS
       NAME 'STATE' 
       STYLE
         SYMBOL 0 
         SIZE 2 
         OUTLINECOLOR 0 0 0
         COLOR 255 255 127
       END
    END
  END

  Where do I write info_format = text/plain for getting the attributes as
plain text.

2) How do I collect the attribute data in a javascript function or
openlayers event,function.Presently I am only making 
   a WMS  call to each of the layers in a mapfile as shown below.

function init() {

         //alert("in init");
         map = new OpenLayers.Map('<%=map.ClientID%>');

         //
         layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
                "http://localhost:9000/cgi-bin/mapserv.exe?", { map:
'Shape/newwr1.map', layers: 'STATE', 'format': 'png' });

         layer1 = new OpenLayers.Layer.WMS("BASIC",
                "http://localhost:9000/cgi-bin/mapserv.exe?", { map:
'Shape/newwr1.map', transparent: 'true', layers: 'basic', 'format': 'png'
});


           map.addLayers([layer,layer1]);
          map.setCenter(new OpenLayers.LonLat(73.25, 20.35), 6);




          }
The above function is just showing the map layers in a div.
If I have a similar js function what kind of a call do I make to get the
attribute data.

Is there any complete example given somewhere?
Pls reply soon.


-- 
View this message in context: http://n2.nabble.com/getting-Feature-Info-data-directly-from-shp-files-tp4767879p4769867.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list