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

index exception

Topics: General Topics
Sep 4, 2006 at 12:51 PM
Anybody have any idea what this means

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

many thanx
Sep 4, 2006 at 1:58 PM
It means that you were accessing an array and provided it with an index that was either below zero or larger than the size of the array.
Sep 4, 2006 at 2:51 PM
Thanx for the quick reply...really appreciate it.

Im trying to select a spatial boundary from a sql database...within my database theres a Binary select statement which returns one record which is Im faced with the problem of which provider i use....the Oledb - or MSSQL provider. When I use either I get that index exception..any help

Sep 4, 2006 at 10:41 PM
The OleDB provider only supports storing points in an X and Y column.
The MsSql provider is kinda a "hack" for getting MsSql to support spatial data. It requires a binary column containing geometry data as WKB, and four double columns containing the min/max values of X and Y. These columns have specific names, and if they are wrong you could get this error you describe.
There is a method in the MsSql provider for uploading data to the database which will ensure the correct format of the database.
Sep 5, 2006 at 8:51 AM
I know now what was causing thae index exception...My BoundingBox wasn`t pointing to a layer (Dim mapExtents As SharpMap.Geometries.BoundingBox = myMap.Layers(1).Envelope.Grow(10))...

I do get the point displayed by using oledbpoint provider...How do I get the whole spatial boundary....Should I use the hack...;-) I mean the MsSQL provider...cause i need to make the query suburb a different colour...

Am I on the right track hopefully not on the wrong train...

Thanx guys
Sep 5, 2006 at 10:26 AM
The envelope of the layer returns the boundingbox of the data in that layer. I guess thats what you mean by the boundary (there isn't any methods for getting the actually convex boundary of the data if that is what you meant).
Sep 5, 2006 at 10:51 AM
Once again thanks for the reply

All a want to do is display the speicied suburb boundary on a somehow i need to display the binary field...and my assumption is the binary field will draw the suburb binary

Is my assumption correct
Sep 5, 2006 at 11:45 AM
Well I guess that depends on what your binary field contains. SharpMap renders geometry data, not binary fields.
Sep 5, 2006 at 3:39 PM
Hi guys no luck wat so ever...I remember i downloaded an example where you import a shapefile into SQL....the SQL database contain a binary field called also has Envelope Min and Max fields...when viewing the map on that example...the map get drawn...without using the I wana apply the same concept...only thing I`m doing is querying the map to retrieve on record...

hope that makes it a bit clearer as to what I`m doing

Thanx again
Sep 6, 2006 at 1:31 PM
Hi people

Im trying to use the Styling delegate to create a custome theme for my map....problem is wen I do featuredatarow I get about 180 records...whereas theres over 12 000 records....can you please tel me how to resolve this issue

Thanx again