This project has moved. For the latest updates, please go here.
1
Vote

Blank screen as output in Sharpmap with Postgis as the databse

description

Following is the code attached which when executed gives a blank output screen. I am using Postgresql Database with my dbname=osm1.


SharpMap.Layers.VectorLayer myLayer = new SharpMap.Layers.VectorLayer("My layer");
string ConnStr = "Server=127.0.0.1;Port=5432;User Id=postgres;Password=osm;Database=osm1;";
string idColumn = "building";
myLayer.DataSource = new SharpMap.Data.Providers.PostGIS(ConnStr, "planet_osm_polygon", idColumn);

ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory ctFact = new ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
myLayer.CoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator);
myLayer.ReverseCoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator, ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84);

mapBox1.Map.Layers.Add(myLayer);
mapBox1.Map.BackgroundLayer.Add(new SharpMap.Layers.TileAsyncLayer(new BruTile.Web.OsmTileSource(), "OSM"));
mapBox1.Map.ZoomToExtents();
mapBox1.Refresh();
mapBox1.ActiveTool = SharpMap.Forms.MapBox.Tools.Pan;



Kindly help as i am stuck as the db in pgAdmin4 contains all the tables.

comments