New features for SharpMap v0.9

Topics: SharpMap Project, SharpMap v0.9 / v1.x
Coordinator
Aug 3, 2011 at 8:00 PM
Edited Aug 3, 2011 at 9:46 PM

Dear community,

today I added some new features to SharpMap v0.9. For you convinience I'm posting a brief summary:

  • SharpMap.Rendering.Decorations
    I added this new namespace for objects that are related to the maps content and visualization. At the moment there are
    • NorthArrow
    • EyeOfSight (a modified NorthArrow)
    • Disclaimer (some text holding e.g. copyright notices)
    • MapScale
    All these decoration objects have customizable appearance properties like Border, Margin, Opacity, ...
    On my whishlist/workqueue are
    • Legend
    • Frame/Stamp
    Since I will be on vacation the next weeks, you'll have to hold your breath.
  • SharpMap.Rendering.Symbolizer
    I added this namespace for a new approach for rendering layers. In order to do this, I added and assigned
    • IPuntal interface for geometries representing points (point, multipoint)
    • ILineal interface for geometries representing linestrings (linestring, multilinestring)
    • IPolygonal interface .... you get the idea
    For each of these geometry types there are symbolizer implementations
    • RasterPointSymbolizer (pretty close to the way it was done up to now)
    • CharacterPointSymbolizer (symbolizes a point with a character symbol or text)
    • PathPointSymbolizer (symbolizes a point with a custom path)
    • ListPointSymbolizer (symbolizes a point with a sequence of any PointSymbolizer instances)
    • BasicLineSymbolizer (symbolizes a linestring with a pen)
    • BasicLineSymbolizerWithOffset (like BasicLineSymbolizer but with an offset)
    • WarpedLineSymbolizer (symbolizes a linestring with a GraphicsPath pattern warped to the linestring)
    • CachedLineSymbolizer (prepares all graphics paths from the linestrings and applies a sequence of rendering processes to it)
    • BasicPolygonSymbolizer (pretty close to the way it was done up to now)
    • PolygonSymbolizerWithLineSymbolizer ( fills polygon with brush, outlines with any LineSymbolizer)
    For some of these symbolizers there is sample code in the ExampleCodeSnipplets project. The WinFormSamples project has one sample using the new approach
  • SharpMap.Layers.Symbolizer
    In this layer there are the typed vector layers
    • PuntalVectorLayer
    • LinealVectorLayer
    • PolygonalVectorLayer

Did I forget anything? Hope not. If you have any questions, feel free to ask.

I did. Sort of like a waste product of WarpedLineSymbolizer, I found a way to "warp" labels to linestrings. Or was it the other way around?

In case I did break anyones code, the previous version was tagged to

Tags\v0.9\2011-08-03

Enjoy and please do not foget to Review the code.

FObermaier

Developer
Aug 8, 2011 at 7:55 PM

Can you send me an email when you've finished the legends? I don't have  much time at this moment to check SharpMap regularly, but implementing the GetLegendGraphic for the WMS server part is something I always wanted to do :-)

Aug 22, 2011 at 2:53 PM
Edited Aug 22, 2011 at 2:58 PM

Did you forget to add the source files to trunk???

 

Error 1 The type or namespace name 'Symbolizer' does not exist in the namespace 'SharpMap.Rendering' (are you missing an assembly reference?)
Error 2 The type or namespace name 'ILineal' could not be found (are you missing a using directive or an assembly reference?)
Error 3 The type or namespace name 'Symbolizer' does not exist in the namespace 'SharpMap.Rendering' (are you missing an assembly reference?)

Etc...

EDIT: The VS 2008 projects weren't updated...

EDIT2: Are these changes .net 4 compatible only?

Aug 27, 2011 at 5:20 PM

Hi Felix,

I can't seem to get the BackgroundLayer with any of the TileLayerAsync to work. I have lot of points stored in the database and the co-ordinates are all in WGS84. However, I don't see anything in the background! Any pointers on setting up the transforms etc. would be great.

Cheers,
Raghu

Coordinator
Aug 29, 2011 at 8:03 AM

Hello stabones,

maybe you did not grab the latest source? For me everything works fine....

Regarding the vs2008 project you are right, I did not update those projects. I'm not aware that any of those changes are Net40 only, it is just that we decided to move to VS 2010 an use .Net40 to keep the maintenance effort minimal.

Hth FObermaier

Coordinator
Aug 29, 2011 at 8:15 AM
kraghavk wrote:

Hi Felix,

I can't seem to get the BackgroundLayer with any of the TileLayerAsync to work. I have lot of points stored in the database and the co-ordinates are all in WGS84. However, I don't see anything in the background! Any pointers on setting up the transforms etc. would be great.

Cheers,
Raghu

Hello Raghu,

you could use these helper methods (taken from the WinFormSamples project (InitializeOsmWithXls))

#if !DotSpatialProjections

        private static ICoordinateTransformation GetCoordinateTransformation()
        {

            //The SRS for this datasource is EPSG:4326, therefore we need to transfrom it to OSM projection
            var ctf = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
            var cf = new ProjNet.CoordinateSystems.CoordinateSystemFactory();
            var epsg4326 = cf.CreateFromWkt("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]");
            var epsg3857 = cf.CreateFromWkt("PROJCS[\"Popular Visualisation CRS / Mercator\", GEOGCS[\"Popular Visualisation CRS\", DATUM[\"Popular Visualisation Datum\", SPHEROID[\"Popular Visualisation Sphere\", 6378137, 0, AUTHORITY[\"EPSG\",\"7059\"]], TOWGS84[0, 0, 0, 0, 0, 0, 0], AUTHORITY[\"EPSG\",\"6055\"]],PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]], UNIT[\"degree\", 0.0174532925199433, AUTHORITY[\"EPSG\", \"9102\"]], AXIS[\"E\", EAST], AXIS[\"N\", NORTH], AUTHORITY[\"EPSG\",\"4055\"]], PROJECTION[\"Mercator\"], PARAMETER[\"False_Easting\", 0], PARAMETER[\"False_Northing\", 0], PARAMETER[\"Central_Meridian\", 0], PARAMETER[\"Latitude_of_origin\", 0], UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]], AXIS[\"East\", EAST], AXIS[\"North\", NORTH], AUTHORITY[\"EPSG\",\"3857\"]]");
            return ctf.CreateFromCoordinateSystems(epsg4326, epsg3857);
#else
        private static DotSpatial.Projections.ICoordinateTransformation GetCoordinateTransformation()
        {
            var epsg4326 = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;
            var epsg3857 = new DotSpatial.Projections.ProjectionInfo();
            epsg3857.ReadEsriString("PROJCS[\"Popular Visualisation CRS / Mercator\", GEOGCS[\"Popular Visualisation CRS\", DATUM[\"Popular Visualisation Datum\", SPHEROID[\"Popular Visualisation Sphere\", 6378137, 0, AUTHORITY[\"EPSG\",\"7059\"]], TOWGS84[0, 0, 0, 0, 0, 0, 0], AUTHORITY[\"EPSG\",\"6055\"]],PRIMEM[\"Greenwich\", 0, AUTHORITY[\"EPSG\", \"8901\"]], UNIT[\"degree\", 0.0174532925199433, AUTHORITY[\"EPSG\", \"9102\"]], AXIS[\"E\", EAST], AXIS[\"N\", NORTH], AUTHORITY[\"EPSG\",\"4055\"]], PROJECTION[\"Mercator\"], PARAMETER[\"False_Easting\", 0], PARAMETER[\"False_Northing\", 0], PARAMETER[\"Central_Meridian\", 0], PARAMETER[\"Latitude_of_origin\", 0], UNIT[\"metre\", 1, AUTHORITY[\"EPSG\", \"9001\"]], AXIS[\"East\", EAST], AXIS[\"North\", NORTH], AUTHORITY[\"EPSG\",\"3857\"]]");
            return new DotSpatial.Projections.CoordinateTransformation() { Source = epsg4326, Target = epsg3857 };
#endif

Hth FObermaier