Live data feeds

Topics: Data Access, SharpMap v2.0
May 15, 2009 at 6:26 AM

Despite earlier posts I got a SQL Server 2008 spatial connection up and running with SharpMapv2. I have some questions though about live data.

I'm planning on using SharpMap as a view/edit tool for my spatial data that resides in a SQL 2008 spatial database. Some featuredata in the database is automatically updated every 2 seconds or so from another application. Can SharpMap somehow detect updates and trigger a refreshmap or must I periodically call refreshmap from my SharpMap application?

When I call refreshmap the mapviewer doen't update because the viewmatrix hasn't changed. How is live data supposed to work in SharpMap v2? Should I maybe use v0.9?

Any suggestions are welcome

/best regards

Jonas Nilsson

Coordinator
May 15, 2009 at 8:28 AM
Edited May 15, 2009 at 8:28 AM

Hi Jonas, assuming sql server 2008 still supports SqlDependency you could probably use that http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.aspx to trigger a changed action. The lack of refresh is a bug, but will probably remain until we replace the whole rendering pipeline (or somebody submits a patch :) ). hth jd

Coordinator
May 15, 2009 at 2:39 PM

No patch, but

  • adding
/// <summary>
/// Forces all Layers to be requeried
/// </summary>
void Requery();

  to SharpMap.Presentation.Views.IMapView2D interface,

  • adding
/// <summary>
/// Forces all Layers to be requeried
/// </summary>
internal void Requery()
{
    RenderAllLayers();
}

  to the MapPresenter class, and

  • implementing Requery() in your MapView Class (MapViewControl, WebMapView, ...)
/// <summary>
/// Forces all Layers to be requeried
/// </summary>
public void Requery()
{
    _presenter.Requery();
}

did work for me.

Hth

FObermaier.