This project has moved and is read-only. For the latest updates, please go here.

PostGIS data provider compilation

Sep 15, 2006 at 12:56 PM

I am using sharpmap latest binary and trying to connect postgis database. As I learnt that the latest version come with separate extensions. When I download postgis.cs and compile as a .dll, I am getting an error "SharpMap.Map.numberFormat_EnUS" which is not available in sharpmap.dll.

If anybody come across this problem please let me know the solution. Thanks in advance.


Sep 15, 2006 at 2:50 PM
Hi betapudi,

The PostGIS provider used to be inside of the SharpMap project, so had access to members of types which were marked "internal".

Since that isn't the case now, you probably have 3 options:

1) Just include the PostGIS.cs file in the SharpMap project.
2) Use a new instance of the NumberFormatInfo class like this: new System.Globalization.CultureInfo("en-US", false).NumberFormat;
3) Add the PostGIS project as a friend assembly using InternalsVisibleToAttribute.
Sep 15, 2006 at 2:51 PM
Oops, sorry, wiki formatting looks like it didn't work on that last one. The Url for InternalsVisibleToAttribute is:
Sep 15, 2006 at 3:28 PM
I think that in a next release of SharpMap.dll it should be made "public" or extension clases should define it by their own.
Sep 15, 2006 at 3:38 PM
Good feedback, rstuven -

Does PostGIS only do en_US formatting? I know that shapefile needs this formatting, but I would think that more sophisticated providers wouldn't have a requirement to be tied to a specific culture.

Perhaps it is something that belongs in each provider, rather than being a public memeber on type Map.
Sep 15, 2006 at 11:10 PM

The en_US constant is used for several providers, where a colon have to replaced by point, because of different decimal sign.

I think it is better to provide a "SharpMap provider extension" assembly where all 3rd party or providers with external dependencies are stored.

Sep 16, 2006 at 7:00 AM
I will try. Thank you very much to all for the valuable feedback & help.
Sep 16, 2006 at 9:46 AM
I am able to compile postgis.cs to a seperate .dll by using a new instance of NumberFormatInfo like this:

public System.Globalization.NumberFormatInfo NumberFormat;

It is working well. Thanks to all.