[mapserver-users] polygon fill
rishi
rishe28 at gmail.com
Mon Mar 16 02:54:10 PDT 2015
hi all
iam trying to highlight the villages based on query
but only one polygon is highlighting
the query is based on the area of the villages, when user enters area
<=********** ,it is displaying 13 villages in the grid and also same time
it has to highlight the villages on the map
my code is
aspx page
protected void btnselect_Click(object sender, EventArgs e)
{
string query = "";
query = String.Format(" select
gid,box(geom),villname,geom,area(geom) from villages where area(geom) " +
ddlsymb.SelectedValue + " " + txtarea.Text + " ");
dt = MyClass.getData(query);
if (dt == null || dt.Rows.Count == 0)
{
Response.Write("No record found, Try Zoom in and click close to
feature.");
}
else
{
dr = dt.Rows[0];
//String selectedGID = dr["gid"].ToString();
//gid = selectedGID;
var layername = "villages";
for(int i=0;i<dt.Rows.Count;i++)
{
dr = dt.Rows[i];
String selectedGID = dr["gid"].ToString();
gid = selectedGID;
Response.Write(String.Format(@"<script>window.parent.highlightnav('{0}','{1}');</script>",
gid, layername));
//Locate(query);
}
if (dt.Columns.Contains("gid"))
{
dt.Columns.Remove("gid");
}
if (dt.Columns.Contains("geom"))
{
dt.Columns.Remove("geom");
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
js page
function highlightnav(gid,layername)
{
bPoint.params.gid = gid;
bPoint.params.tbl = layername;
//bPoint.params.getElementById = geom;
bPoint.redraw();
}
mapfile bpoint.map
MAP
EXTENT 8240841.450745 2400319.900386 9218007.463612 3107183.406947
TRANSPARENT on
IMAGETYPE png
SIZE 450 500
SYMBOLSET "symbols.txt"
web
metadata
wms_srs "EPSG:4326 EPSG:900913"
end
end
LAYER
CONNECTIONTYPE postgis
CONNECTION "user=postgres password=****** dbname=mpdb port=5432"
DATA "geom FROM (select geom,gid from %tbl% where gid=%gid%)as foo using
srid=900913 using unique gid"
STATUS Default
TYPE point
PROJECTION
"init=epsg:900913"
END
class
style
symbol 'line20'
color 255 0 0
size 10
end
end
END
END
i created for loop, to highlight all the polygons, but it is highlighting
only one polygon.
plz tell me the code
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20150316/34b6abbd/attachment.htm>
More information about the MapServer-users
mailing list