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

Adding controls to the demo project

Mar 30, 2010 at 3:37 PM


I am using sharpmap v2 AspNet Demo Project using MSSQL Server 2008 data and it worked successfully. Now I want to add functionality like zoom in/zoom out/select which I see in the sharplayers demo project. I tried searching through the forum but couldn't find anything. How do I integrate the two projects and play with the rendered map?



Mar 30, 2010 at 6:16 PM

Hi MHV, beware that there are issues with the renderer when used on a webserver due to flaws in the design of GDI, there is work being done to address this - it manifests itself more on multi core machines.
to add tools to the sharplayers map you add to the <Tools></Tools> element in the markup (there are some tools added by default).

                <edit:EditingTools runat="server" ID="editTool1">
                    <BuilderParams EditableLayerId="VectorLayerComponent1" />
                <switch:LayerSwitcherTool runat="server" ID="layerSwitcherTool1">
                    <BuilderParams />
                <gen:GenericOLControl ID="GenericOLControl1" runat="server">
                    <BuilderParams OpenLayersClassName="OpenLayers.Control.Navigation" />
                <gen:GenericOLControl ID="GenericOLControl2" runat="server">
                    <BuilderParams OpenLayersClassName="OpenLayers.Control.PanZoom" />

 Zoom in can be done by holding down the shift key and dragging a box.

If you are hosting through the dev webserver you need to make sure that the port is updated in the sharplayers demo (not you can add multiple urls and they will be hit in a round robin style):

        <cc1:UriValue Value="http://localhost:51464/Maps/Map.ashx" />
<%--This should be updated to the port number assigned by vs dev web server or IIS to the SharpMap.Demo.AspNet project --%>

Quite a lot functionality from openlayers is surfaced to a greater or lesser degree, though there are gaps.. It is fairly straight forward to fill them by inheriting from the relavent base classes and overriding the necessary parts -  both in JS and CS.

One area you may like to investigate with Firefox/Firebug is the js object $olRegistry which acts as a client side bridge between the Asp.Net Ajax world and the OpenLayers ajax world.


cheers jd 

Apr 5, 2010 at 10:07 PM

Thankyou JD.

My Map.ashx started working but now Wms.ashx is giving problems. I have posted the problem in another discussion. Please lemme know if you can help with the same.....