I am currently doing a project that needs a GIS front-end interface to visualize geographical objects (road networks), and a back-end geo-spatial database to implement network analysis (SQL based). Our development platform is based on C#. I understand QGIS is powerful and available but as we really want to build an independent platform so we do not consider it.

Now, the progresses include:

  • I have built a front-end Dotspatial based GIS interface, it can display the road networks and query them as we want.
  • I have installed the PostgresSQL and its spatial extension PostGIS.

However, the current issue is how to connect the Dotspatial GIS platform with PostGIS/PostgresSQL in order to perform the analysis we need. What I really want is to do all activies at interface side. For example, by selecting a button the software do analysis automatically, and everything is going without other operation at PostGIS database side.

How can I start? Any information or helps? Many thanks!

2 Answers 2


Russel is right, currently there is no driver that would let you connect your dotSpatial application to a PostgreSQL/PostGis database.

However you could load your features into a FeatureSet and display that. There is an example in the dotSpatial discussion forum that describes how to do just that with an SqlServer 2008+ database table. You can use that as a head start. A side note, this is a readonly, all-in-memory approach.

I don't know why you're going with dotSpatial, SharpMap is my first choice.

  • Hello FObermaier,
    – Hao Ye
    Jul 1, 2013 at 13:08
  • 1
    Hello FObermaier, I have just found a library called Npgsql which allow me easily connecting to PostGIS and PostSQL database based on windows form C#. I think I might need to write some code to read the data table and display it on the map?
    – Hao Ye
    Jul 1, 2013 at 13:18
  • Hello FObermaier, you mentioned a example in the discussion as it was shown in dotspatial.codeplex.com/workitem/206, but I could not find this example as the web has gone. Do you have other example shown on the internet?
    – Hao Ye
    Jul 1, 2013 at 13:23
  • Hello FObermaier, Do you know any Open-source GIS that has the extension to PostGIS so I can work with? Can SharpeMap do that for me?
    – Hao Ye
    Jul 1, 2013 at 13:42
  • The code to read the featureset is at the bottom of the discussion. You certainly need to adapt that for the use of PostGis. Basically it boils down to replacing system.data.sqlclient with npgsql and Sql[Geometry|Geography]Reader with PostGisReader. SharpMap has a PostGis provider and can display that kind of data nicely
    – FObermaier
    Jul 2, 2013 at 7:42

From a quick look at the Dotspatial documentation it appears that it only works with shapefiles and you would need to write your own extension for PostGIS or OGR.

You might have a look at MapDotNet- www.mapdotnet.com - a fully featured .Net GIS suite supporting a number of back-ends including PostGIS.

Disclaimer: I am a MapDotNet developer.

  • Many thanks for your reply.I had a look at MapDotNet but i think as it is commercial one and our project cannot provide that big sum of money, (up to $1000 per/year is expensive)
    – Hao Ye
    Jun 26, 2013 at 14:44
  • 1
    You can develop and run in Express mode without licensing, however, the server engine will only use two threads instead of letting you configure thread limits. Jun 26, 2013 at 16:00
  • Hello Russell, thanks. But what is the difference of using two threads rather than self-configured thread limits?Do you mean the speed of computation is heavily influenced?
    – Hao Ye
    Jul 1, 2013 at 13:31
  • The thread limit reduces throughput especially under load. Two threads are fine for development or just a small user base (in-house app) but for maximum performance I generally configure 2 threads per core. Jul 2, 2013 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.