ThinkGeo.com    |     Documentation    |     Premium Support

About ShapeFileFeatureSource

Hi i am getting Feature by ID but an error occurs as
Parameter name: Parameter Ids should be from 1 to the record number in ShapeFileFeatureSource
This id my Method:
protected void btnSearch_Click(object sender, EventArgs e)
{
FeatureLayer shapeFileLayer = (FeatureLayer)((LayerOverlay)Map1.CustomOverlays[1]).Layers[“ShapeLayer”];
InMemoryFeatureLayer mapShapeLayer = (InMemoryFeatureLayer)((LayerOverlay)Map1.CustomOverlays[2]).Layers[“InMemoryFeatureLayer”];
shapeFileLayer.Open();
Feature feature = shapeFileLayer.FeatureSource.GetFeatureById(txtGisCode.Text,new string[1]{“UID”});
shapeFileLayer.Close();
mapShapeLayer.InternalFeatures.Clear();
mapShapeLayer.InternalFeatures.Add(feature.Id, feature);
((LayerOverlay)Map1.CustomOverlays[2]).Redraw();
}

Here i am attaching shape files
plz help me out asap

Thanks
ShapeFile.zip (82.6 KB)

Hi Mouni,

If you want to use GetFeatureById, the id should be a number for example “1”, “5” etc. The 2nd parameter is which column you want to read, the value can be found in the feature.ColumnValues.

I think you should want get the feature based on your column “UID”, so the API should be:

Feature feature = shapeFileLayer.FeatureSource.GetFeaturesByColumnValue("UID", "PR71_1")[0];

You can refer the sample: 9288.zip (99.4 KB)

Wish that’s helpful.

Regards,

Ethan

Thank u Ethan for ur help

Regards,
Mouni

Hi Mouni,

Any question please let us know.

Regards,

Ethan

Hi,
Actually, i am trying to create new toipc.But i could not make it.So i replied to this post.
My issue is different.
I want to plot points on map having image of type .png or .jpg or .tif as background.
as given in web edition i tried but at a time i am able to view only image or points…
i want both points and image to display on map at a time.
Please help
Thanks in advance

Hi Mouni,

I think that’s the order reason.

If you put the image layer and point layer into the same overlay, you should want to add the image layer first, then add the point layer.

If you put them into different overlay, you can set the image over IsBaseOverlay equal true.

Please let me know whether it works.

Regards,

Ethan