I'm new to sharpMap and I've some problem when adding a new layer on my VB.NET standalone application.
I'm tryind to add a vector layer with a set of point-of-interest, by loading from a postgres table (with postgis extensions, and geometry fields correctly added).
This is the code:
Dim mymap As New SharpMap.Map(New Size(PictureBox1.Width, PictureBox1.Height))
mymap.BackColor = Color.White
Dim layer1 As New SharpMap.Layers.VectorLayer("roads")
layer1.DataSource = New SharpMap.Data.Providers.ShapeFile("C:\shapefiles\roads.shp")
Dim layer2 As New SharpMap.Layers.VectorLayer("poi")
Dim db As New SharpMap.Data.Providers.OleDbPoint("Server=localhost;port=5432;User Id=user;Password=xyz;Database=mydb;", "poi", "id_poi", "E", "N")
layer2.DataSource = db
PictureBox1.Image = mymap.GetMap()
The first layer loads without problems.
When loading the second I get an error on zoomtoextents() function:
An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
But the argument "Provider" is not listed on the connection string, or I don't know how to specifying it.
More... the "poi" table has the "geom" column that holds geo data, so why I have to specify Est and Nord fields (that fortunately I have)?
The Postgres DB settings are OK (if I try to connect using Postgres Npgsql data connector I have no problems).
VB.NET 2005 Express Edition
Postgres 8.2.4 with postgis extensions.
How can I connect and load the Db data??
Any help will be appreciated!!!
Sorry for my bad english ;-)
Hi, I have the same problem as yours.
Have you solved this?
If you have, could you help me?
Dec 10, 2008 at 2:39 PM
The OleDbPoint provider just builds point out of the x- and y-values of the respective columns. No geometry column is being evaluated.
If you want to do that, use PostGis- or PostGis2-Provider.
is not valid for OleDb.
To use that Provider with PgOleDb, the ConnectionString has to be (according to
"Driver=PostgreSQL OLE DB Provider;Data Source=localhost;location=mydb;User ID=user;password=xyz;timeout=1000;