Coordinate and information in Map

10/5/2014 8:18:30 PM
Total Posts 11

Coordinate and information in Map

dear Forums

If I have one coordinate , i write in address bar..like http://tes.com/position.aspx?x=12.131214&y=-6.123134 and i have a map that this coordinate is above of the map...my question are how to know feature in map that coordinat above of map posisition...?

thank you for your help

regards

Bahar

10/7/2014 12:05:26 PM
MVP
Total Posts 323

Re: Coordinate and information in Map

Try to use the Map.IdentifyFeature method, there is a lot of samples in the standard samples.

Or the Layer.SearchShape method if you are interested about features in a specific layer.

10/7/2014 12:54:42 PM
Total Posts 11

Re: Coordinate and information in Map

it not about even click...but page loading or form that have a coordinate in address bar x and y...

any way thanks...

10/13/2014 11:56:36 PM
Total Posts 11

Re: Coordinate and information in Map

May another idea?
1/17/2015 11:59:28 AM
Total Posts 33

Re: Coordinate and information in Map

Hi Mas Bahar,

i try to get your question, if you mean is add marker from request param x and y then zoom in to the marker, i think you can try code below :

i try combine code from sample AddMarker and ZoomToZoomToLevel in sample code:

protected void Page_Load(object sender, EventArgs e)
{
map.MapUnit = MeasureUnit.Degree;

// add zoom levels level scale
// --------------------------------------------
map.ZoomLevels.Add(10000000); // 0 MaxScale
map.ZoomLevels.Add(1000000); // 1
map.ZoomLevels.Add(100000); // 2
map.ZoomLevels.Add(10000); // 3 MinScale

// add a map layer
AspMap.Layer layer = map.AddLayer(MapPath("MAPS/WORLD/world.shp"));
layer.Symbol.FillColor = Color.Ivory;
layer.Symbol.LineColor = Color.LightGray;
if (!string.IsNullOrEmpty(Request.Params["x"]) & !string.IsNullOrEmpty(Request.Params["y"]))
{
double x, y;
x = Convert.ToDouble(Request.Params["x"]);
y = Convert.ToDouble(Request.Params["y"]);
zoomselected(x, y);
}
}
private void zoomselected(Double x, Double y)
{
AspMap.Point point = new AspMap.Point(x, y); // longitude, latitude
Marker marker = new Marker(point, "Center From Coordinate X :" + x + " Y :" + y);
map.Markers.Add(marker);
map.CenterAndZoom(point, 0);

}