This project has moved and is read-only. For the latest updates, please go here.

Total Newbie Question

Topics: SharpMap v2.0, WinForms Controls
Nov 5, 2007 at 5:12 AM
Is is possible to do this with SharpMap in a Winform?

1) Draw a rubberband or bounding box and have the map zoom to what you selected? I see in the samples you can click the Zoom button and it just zooms when you click, but I really want to zoom to a particular area.
2) Return a list of items that fall into that rubberband or bounding box? For example, lets say I added a layer with Call Centers around the world. If I draw a box around a particular area, I can identify what Call Centers fall within that box?
3) Are there any more examples out there to look at to see how to do these things other then the three to download?

Nov 5, 2007 at 9:42 AM
This is all built in to v2.0.

Just set the map's ActiveTool property to the Zoom tool, and draw on the map control. You can set the tool to Query and get the features on each layer which intersect the query region.
Nov 5, 2007 at 3:52 PM
I did that, but I am not getting the functionality I am looking for. I downloaded the WMS sample, which is similar to what I am trying to do. What happened is that if I click on the ZOOM IN button and try to draw on the map, the minute I click on the map it zooms. So I cannot draw a bounding box to zoom too.

This tool seems really cool, but being that I am a developer and not a GIS guy, I am just having a hard time understanding how to make it work like I need. Are there any other samples out there other then the three to download? Or can someone send me a sample of doing the things I mentioned above?

What I am trying to do is this. I work for a Geology department. We plot samples around the world. So I need to hook up to some images that will let me get the closets in rural areas (aka like in the deserts of Nevada) and then draw layers of samples around the world. Then the user can draw a box around an area and all the samples that fall into that area will be displayed as well as it zooming into that. And then I could display those samples in a grid. I downloaded the help files, and they are good. But I really need to see examples of how the functionality is used.

I know it is much, but I figured it wouldn't hurt me throwing it out there.
Nov 5, 2007 at 4:44 PM
Are you sure you are using v2.0? I don't know of any WMS sample for v2.0, and the zoom behavior you are describing behaves like v1.0.

I'm doing something exactly like you are describing in your narrative, but just setting the Map.ActiveTool property to StandardMapTools2D.ZoomIn. Is this what you tried to do?
Nov 5, 2007 at 5:47 PM
oworld... make sure you are using V2 from the Google sources, and not from the CodePlex sources. The V2 on CodePlex sources is really V1, and yes, on that, you will get behavior exactly as you have described.
Nov 5, 2007 at 10:05 PM

Thanks for the suggestion. However, when I go to the project in google source, it is empty. Do you have a link to the source? Also, with 2.0 are their more examples, etc?