Using SQL Join for datasource

Topics: Data Access, General Topics, SharpMap v0.9 / v1.x
Oct 15, 2007 at 10:17 PM
I was wondering the best way to use an SQL join as the datasource of a new layer. I'm running a SQL statement to join the geometry and the needed attributes from multiple tables. I was wondering what the best way would be to add the records returned to the map as a layer.
Oct 16, 2007 at 1:08 AM
If you are using SQL Server, you could set up a View (which is just a query that appears as a table). I've used this to create a feature table containing the WKB_Geometry and attributes from multiple tables as the source for a new VectorLayer. See how this goes for you.

Oct 16, 2007 at 6:08 AM
Steve's got the right approach. This is generally how the Open GIS Consortium's recommendation on SQL access to simple features is implemented: create a view to get the required attributes with the given geometry.
Oct 16, 2007 at 10:26 PM
Thanks Steve,
I don't know why I didn't think of creating a view. It definitely makes it easier than what I was doing. I knew there was a better way