Sharpmap features - shapes , user selection

Topics: SharpMap Project
Feb 2, 2009 at 10:43 AM
Edited Feb 2, 2009 at 10:45 AM

Hi ,

We are in the process of evaluating sharpmap with a  view to replacing mapinfo .

probably some basic questions hopefully which you may be able to answer

tool ref: winform / org provider /geometryfeatureprovider

GOAL: to allow the user to draw a shape over the map and we display the data
related to the selected area using the map queried event.

 we set the activetool of the map to query.
when the the user draws a rectangle on the map the rectangle area
the rectangle/elliptical box we expect would be drawn doesnt appear to be drawn on the screen.  although some invisible area selection happens
and the map queried event is fired which the returns the data although its never obvious to the user the area which he has selected.

comming from a mapinfo world and assuming sharpmap to have implemented similar things.
would the user be able to select a shape control (eg ellipse , polygon ,rect ) from a tool box
and when he draws the shape on the map its dynamically drawn as the user moves the mouse with the right button down.

or is there an entirely different approach to this. or are we missing something here ?

Feb 2, 2009 at 5:44 PM
Hi bijoythulas, this functionality is not standard in 0.9/1.x but is very easy to implement, see for a starting point.

One way to do this would be:
Track mouse down / move events
Store them in a list
Convert them to real world coordinates using Map.ImageToWorld
Create a new Geometry from the converted coords
Draw the Geometry on the map using a GeometryProvider and VectorLayer.

Alternatively you could create a new ILayer class and implement a custom render.
hth jd
Feb 2, 2009 at 9:38 PM
thanks for your reply john.

we are at the evaluation stage only.

wondering whether this is feature will be available out of the box in version 2.  have been playing around the the version 2 code base from the code branch since reading this and havent got a start yet.



Feb 3, 2009 at 8:30 AM
Hi bijoy - the real v2 is at It certainly goes further in the direction you describe but currently there is no support for raster datasets or GDAL/OGR.
It will:
Draw the query shape over the map
Highlight the selected features.
The whole rendering system is being overhauled on a branch and is subject to quite a big change.
Also at present there is no 'Tool Box' just the tools' functionality - you provide your own UI to select /manage tools
hth jd