Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

how can i add tiled layer on Sharpmap using postgresql? [on hold]

$
0
0
map = new Map();
            try
            {
                //VectorLayer v = new VectorLayer("Point", new PostGIS("server=localhost;port=5433;user=postgres;pwd=9839757437;database=OSM3", "GhanaRegions", "Geometry", "id"));
                VectorLayer v = new VectorLayer("Point", new PostGIS("server=localhost;port=5433;user=postgres;pwd=9839757437;database=OSM3", "ghanalocation", "geometry", "id"));
                VectorLayer v2 = new VectorLayer("Point", new PostGIS("server=localhost;port=5433;user=postgres;pwd=9839757437;database=OSM3", "multilines", "geometry", "id"));
                v.Style.EnableOutline = true;
                v.Style.Outline = Pens.Black;
                v.Style.Fill = Brushes.Red;
                v.Style.PointColor = Brushes.LightGreen;
                SharpMap.Layers.LabelLayer layLabel = new SharpMap.Layers.LabelLayer("Name");
                layLabel.DataSource = new PostGIS("server=localhost;port=5433;user=postgres;pwd=9839757437;database=OSM3", "citie33", "geometry", "id");
                layLabel.Enabled = true;
                layLabel.LabelColumn = "Name";
                layLabel.MaxVisible = 2;
                layLabel.MaxVisible = 190;
                layLabel.MinVisible = 130;
                layLabel.MultipartGeometryBehaviour = SharpMap.Layers.LabelLayer.MultipartGeometryBehaviourEnum.Largest;
                layLabel.LabelFilter = SharpMap.Rendering.LabelCollisionDetection.ThoroughCollisionDetection;
                layLabel.PriorityColumn = "id";
                layLabel.Style.ForeColor = Color.Beige;
                layLabel.Style.Font = new Font(FontFamily.GenericSerif, 12);
                layLabel.Style.BackColor = new System.Drawing.SolidBrush(Color.FromArgb(128, 255, 0, 0));
                layLabel.Style.HorizontalAlignment = SharpMap.Styles.LabelStyle.HorizontalAlignmentEnum.Center;
                ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctFact = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
                v.CoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);
                v.ReverseCoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator, ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84);
                map.Layers.Add(v);
                map.Layers.Add(v2);

                mapImage1.Map.BackgroundLayer.Add(new SharpMap.Layers.TileAsyncLayer(new BruTile.Web.OsmTileSource(), "OSM"));
                layLabel.Style.CollisionDetection = true;
                mapImage1.Map.ZoomToExtents();
                mapImage1.Refresh();
                mapImage1.ActiveTool = SharpMap.Forms.MapImage.Tools.Pan;
                mapImage1.Map = map;
                //ICoordinateTransformationFactory ctFact = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();


            }
            catch (Exception ex)
            {
            }

Viewing all articles
Browse latest Browse all 1138

Trending Articles