In general, you are on the right way. There are some missing parts that do not allow you to see a desired result.
The most crucial issue is null value of GetExtent method in your provider. This method is either empty or not implemented at all. In order MapSurfer.NET could properly visualize data, it is required to return the extent and projection of the data set.
Normally, GetExtent is implemented as follows:
private Envelope _extent;
public Envelope GetExtent()
{
if (_extent == null)
{
d
ouble minx, miny, max, maxy;
using (OracleConnection conn = new OracleConnection (
true))
{
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT minx, miny, maxx, maxy FROM " + tablename; // this a rough idea, check Oracle Spatial functions to extract extent of the data set from a table.
| OracleDataReader r = cmd.ExecuteReader(); |
| if (!(r.IsDBNull(0) || r.IsDBNull(1) || r.IsDBNull(2) || r.IsDBNull(3))) |
}
_extent = new Envelope(minx,miny,maxx,maxy);
}
return _extent;
}
For some really huge tables, the computation of the table's extent might take several seconds or even minutes. To avoid this delays, you can add an additional parameter into Initialize method such as
m_dsProvider.Initialize(new MapSurfer.Configuration.
ParameterCollection() { new MapSurfer.Configuration.Parameter()
{ Name = "ConnectionString", Value = "Data Source=gis101;User
Id=gispeti;Password=peti101; Connection Timeout = 60; " } }, "",
new MapSurfer.Configuration.Parameter()
{ Name = "Extent", Value = "0,0,180,90" }};)
In Initialize method, you just create _extent object from the values given above.
Second, you symbolization is not complete. In PointSymbolizer you have to specify a GraphicSymbol through
ExternalGraphicSymbol imageSymbol = new ExternalGraphicSymbol ();
imageSymbol.Path = "D:\image.png";
symbol.Graphic.GraphicSymbols.Add(imageSymbol );