how to build Sharpmap sourcode

Topics: General Topics
Apr 5, 2011 at 11:21 PM

Hi,

I have downloaded source = sharpmap-85925. Could anyone of you please tell me how to build this project with step by step. When I open this Sharpmapusing VS 2008 solution file using vs 2008 it shows lots of errors. please help me to do this.

 

DeviMurugan

Coordinator
Apr 6, 2011 at 8:55 AM

could you post the compile output.

Apr 6, 2011 at 8:17 PM
Edited Apr 6, 2011 at 8:21 PM

I would like to explain step by step,

  1. Opened 'SharpMap.VS2008.sln' file from folder 'sharpmap-85925\Trunk' since am using VS 2008.
  2. Build the top main 'SharpMap.VS2008' solution which contains 9 projects.
  3. I got the below error messages, also I can see that 'Soution Items' folder is in 'Exclude' like mode but I can't include that. Please help to build this project.

Error    1    The type or namespace name 'BruTile' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileAsyncLayer.cs    7    7    SharpMap.VS2008
Error    2    The type or namespace name 'BruTile' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileAsyncLayer.cs    8    7    SharpMap.VS2008
Error    3    The type or namespace name 'BruTile' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileLayer.cs    9    7    SharpMap.VS2008
Error    4    The type or namespace name 'BruTile' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileLayer.cs    10    7    SharpMap.VS2008
Error    5    The type or namespace name 'ITileSource' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileAsyncLayer.cs    17    31    SharpMap.VS2008
Error    6    The type or namespace name 'ITileSource' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileAsyncLayer.cs    22    31    SharpMap.VS2008
Error    7    The type or namespace name 'ITileSource' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileLayer.cs    24    28    SharpMap.VS2008
Error    8    The type or namespace name 'MemoryCache' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileLayer.cs    25    28    SharpMap.VS2008
Error    9    The type or namespace name 'Converters' does not exist in the namespace 'ProjNet' (are you missing an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Data\Providers\ShapeFile.cs    27    15    SharpMap.VS2008
Error    10    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    37    65    SharpMap.VS2008
Error    11    The type or namespace name 'ICoordinateSystem' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Geometries\IGeometry.cs    39    9    SharpMap.VS2008
Error    12    The type or namespace name 'ICoordinateSystem' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Geometries\Geometry.cs    42    17    SharpMap.VS2008
Error    13    The type or namespace name 'ICoordinateSystem' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Geometries\Geometry.cs    54    16    SharpMap.VS2008
Error    14    The type or namespace name 'ICoordinateTransformation' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\Layer.cs    55    17    SharpMap.VS2008
Error    15    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    59    62    SharpMap.VS2008
Error    16    The type or namespace name 'ITileSource' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileLayer.cs    66    26    SharpMap.VS2008
Error    17    The type or namespace name 'ITileSource' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileLayer.cs    79    26    SharpMap.VS2008
Error    18    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    86    53    SharpMap.VS2008
Error    19    The type or namespace name 'ICoordinateTransformation' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\Layer.cs    88    24    SharpMap.VS2008
Error    20    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    104    68    SharpMap.VS2008
Error    21    The type or namespace name 'TileInfo' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Layers\TileAsyncLayer.cs    105    44    SharpMap.VS2008
Error    22    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    127    68    SharpMap.VS2008
Error    23    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    150    59    SharpMap.VS2008
Error    24    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    166    73    SharpMap.VS2008
Error    25    The type or namespace name 'ICoordinateSystem' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Data\Providers\ShapeFile.cs    172    11    SharpMap.VS2008
Error    26    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    181    87    SharpMap.VS2008
Error    27    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    197    78    SharpMap.VS2008
Error    28    The type or namespace name 'IMathTransform' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\CoordinateSystems\Transformations\GeometryTransform.cs    213    96    SharpMap.VS2008
Error    29    The type or namespace name 'ICoordinateSystem' could not be found (are you missing a using directive or an assembly reference?)    D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\Data\Providers\ShapeFile.cs    296    10    SharpMap.VS2008
Error    30    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\bin\Debug\SharpMap.dll' could not be found    SharpMap.Extensions.VS2008
Error    31    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\bin\Debug\SharpMap.dll' could not be found    SharpMap.UI.VS2008
Error    32    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\bin\Debug\SharpMap.dll' could not be found    ExampleCodeSnippets
Error    33    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap.Extensions\bin\Debug\SharpMap.Extensions.dll' could not be found    ExampleCodeSnippets
Error    34    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\bin\Debug\SharpMap.dll' could not be found    UnitTests.VS2008
Error    35    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap.SqlServerSpatialObjects\bin\Debug\SharpMap.SqlServerSpatialObjects.dll' could not be found    UnitTests.VS2008
Error    36    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap.Extensions\bin\Debug\SharpMap.Extensions.dll' could not be found    UnitTests.VS2008
Error    37    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\bin\Debug\SharpMap.dll' could not be found    DemoWinForm.VS2008
Error    38    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap.UI\bin\Debug\SharpMap.UI.dll' could not be found    DemoWinForm.VS2008
Error    39    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap\bin\Debug\SharpMap.dll' could not be found    WinFormSamples.VS2008
Error    40    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap.UI\bin\Debug\SharpMap.UI.dll' could not be found    WinFormSamples.VS2008
Error    41    Metadata file 'D:\Murugan Project\sharpmap-85925\Trunk\SharpMap.Extensions\bin\Debug\SharpMap.Extensions.dll' could not be found    WinFormSamples.VS2008

Coordinator
Apr 6, 2011 at 9:45 PM

you are not using an express version of visual studio 2008, are you?

anyway. Please check if the core sharpmap project has a reference to brutile.dll, which resides in the external references folder

Depending on the configuration you may need to add an additional reference to ProjNet.dll or DotSpatial.Projections.dll, which are in that folder too.

Hth FObermaier

Apr 6, 2011 at 11:02 PM

Yes, you are right i did n't use visual studio express 2008. Also as you said I added the Brutile and Proj.Net dlls referrence, it compiled successfully. Great thanks.

Now I got another problem, actually have a click function which will provide the feature attribute data, but when i clicked the map got the following error message in SQLServer2008.cs..

"A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry":
System.FormatException: 24305: The Polygon input is not valid because the ring does not have enough distinct points. Each ring of a polygon must contain at least three distinct points"

I have already read one of your reply for this kind of problem "http://sharpmap.codeplex.com/discussions/232775".

Could you please tell me that how to include or extract that patch file (6438) to solve that issue, also please note that patch file (6438) is not available currently I think (could you please provide the correct one).

Coordinator
Apr 6, 2011 at 11:37 PM

that patch has been applied some time ago. the sqlserver2008 provider has a boolean property called something like UseMakeValid or ValidateGeometries, but I do not know if that is the solution to your problem, since all of your geometries get rendered without any problems.

Maybe the input geometry/bounding box does not match sqlserver2008 standards

which functions is called ExecuteIntersectionQuery with BoundingBox or with geometry?

cheers FObermaier

Apr 7, 2011 at 4:42 AM

Thanks Fobermaier,

Please find the event method which I used to get the above mentioned error,

 

protected void imgMap_Click(object sender, ImageClickEventArgs e)
    {
        SharpMap.Geometries.Point ClickPnt = myMap.ImageToWorld(new System.Drawing.Point(e.X, e.Y));
          

        //Set zoom value if any of the zoom tools were selected
        if (rblMapTools.SelectedValue == "0") //Zoom in
            myMap.Zoom = myMap.Zoom * 0.5;
        else if (rblMapTools.SelectedValue == "1") //Zoom out
            myMap.Zoom = myMap.Zoom * 2;

        SharpMap.Layers.VectorLayer pointsOfInterestLayer = new SharpMap.Layers.VectorLayer("PointsOfInterest");
        System.Collections.ObjectModel.Collection<SharpMap.Geometries.Geometry> geomCol =
            new System.Collections.ObjectModel.Collection<SharpMap.Geometries.Geometry>();

        geomCol.Add(ClickPnt);

        pointsOfInterestLayer.DataSource = new SharpMap.Data.Providers.GeometryProvider(geomCol);
        pointsOfInterestLayer.Style.Symbol = new Bitmap(Server.MapPath(@"~\App_data\008.bmp"));


       
        myMap.Layers.Add(pointsOfInterestLayer);


        //myMap.ZoomToExtents();

        //locationAjaxMap.Map.Layers.Add(pointsOfInterestLayer);
        //locationAjaxMap.Map.ZoomToExtents();

        //Save the new map's zoom and center in the viewstate
        ViewState.Add("mapCenter", myMap.Center);
        ViewState.Add("mapZoom", myMap.Zoom);

        //for display the selected SHOP data
        SharpMap.Data.FeatureDataSet ds = new SharpMap.Data.FeatureDataSet();


        SharpMap.Layers.VectorLayer layer = myMap.Layers[0] as SharpMap.Layers.VectorLayer;

        layer.DataSource.Open();
        layer.DataSource.ExecuteIntersectionQuery(ClickPnt.GetBoundingBox(), ds);

        layer.DataSource.Close();

        this.GridView1.DataSource = ds.Tables[0];
        this.GridView1.DataBind();

        //Create the map
        CreateMap();
    }

Thanks in advance,

deviMurugan

Coordinator
Apr 7, 2011 at 6:54 AM

Why reinvent the wheel, there are ready to use controls for Windows.Forms in the SharpMap.UI project. To see how they work, check out winformsamples project.

Please try setting SqlServer2008.ValidateGeometries to true.

Hth FObermaier

Developer
Apr 7, 2011 at 6:55 AM

In my custom version of sharpmap (that I use in a project that read data from sqm2008) I've modified the sql2008 provider like this:

public void ExecuteIntersectionQuery(
   BoundingBox bbox,
   FeatureDataSet ds)
{
   using (SqlConnection conn...)
   {
      bool zero = bbox != null && bbox.GetArea() == 0;
       if (zero)
          bbox = bbox.Grow(QueryTolerance);
   ...
   }
}

I think that this can be related to your problem.

If this patch fix your problem, please let me know so we can patch the trunk version with this code

Apr 7, 2011 at 7:54 PM

Hi D_Guidi,

Thanks a lot. Your fix worked like a charm. Great. Anyway I have assigned QueryTolerance value as '5'.

----Devimurugan

Apr 7, 2011 at 7:55 PM

Thanks Fobermaier.

Your help is much appreciated.

Editor
Jan 11, 2012 at 8:35 AM

im using vs 2008 pro, when I rebuild project , get error:

 

Error	1	The type or namespace name 'Concurrent' does not exist in the namespace 'System.Collections' (are you missing an assembly reference?)

help me

Developer
Jan 11, 2012 at 8:47 AM

System.Collections.Concurrent is a namespace available only with .NET Framework 4.0, so I think you should try to open the project with VS2010.