Hi David,
I've really just taken snippets from two of your sample apps, and I think it's all there. I'm just trying to display my projected SQL 2008 data in the map any way I can.
I understand what you're saying about projections going beyond their definition. However, as I wrote, all my data's in a projection, usually utm 32n. LatLong and other world projections are simply not relevant for my usage, so I need the software to be able to handle such, and I assume it does.
But even though I remove the "world" layer, and only add my projected data (without any re-projection), using a fixed viewport that I know corresponds to my data, it doesn't show up in my map.
I added the call to GetAllFeatures as suggested, although GetCount ought to be ok. And sure enough, it returns a valid X,Y.
The stripped down code's like this (hope it renders correctly):
Imports ThinkGeo.MapSuite.Core Imports ThinkGeo.MapSuite.WebEdition Partial Public Class _Default Inherits System.Web.UI.Page Const CONNECT_SQL As String = _ "Data Source=127.0.0.1,1433;Network Library=DBMSSOCN;Initial Catalog=MAPS;User ID=sa;Password=helledusseda;" Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Map1.StaticOverlay.TileType = TileType.MultipleTile Map1.EnableViewState = True TextBox1.Text = "Hello World" Map1.MapUnit = GeographyUnit.Meter Dim KomLyr As MsSql2008FeatureLayer = _ New MsSql2008FeatureLayer(CONNECT_SQL, "NyKommuner", "ID") KomLyr.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country2 KomLyr.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 Map1.StaticOverlay.Layers.Add("Kommuner", KomLyr) KomLyr.Open() Dim cols As New Collection(Of String) Dim fts As New Collection(Of Feature) cols.Add("KOMMUNENAVN") cols.Add("KOMNR") fts = KomLyr.QueryTools.GetAllFeatures(cols) TextBox1.Text = _ "X = " + fts(2).GetShape.GetCenterPoint.X.ToString() + _ ", Y = " + fts(2).GetShape.GetCenterPoint.Y.ToString() KomLyr.Close() Map1.CurrentExtent = New RectangleShape(300000, 6500000, 800000, 6000000) End If End Sub End Class
After it's run, the textbox shows this text: "X = 717829,692407861, Y = 6183640,91546655", which is as expected.
This is an snippet of my script to create the SQL 2008 based shapes table:
Create Table [NyKommuner] (
[KOMMUNENAVN] varchar(40),
[REGION] varchar(40),
[KOMNR] int,
[feature] geometry,
[ID] [int] IDENTITY(1,1) NOT NULL,
CONSTRAINT [PK_NyKommuner] PRIMARY KEY CLUSTERED
([ID] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
);
...
Insert Into NyKommuner ([KOMMUNENAVN],[REGION],[KOMNR],[feature])
Values ('Gladsaxe','Hovedstaden',159,geometry::STGeomFromText('POLYGON((715740 6186782, ... ,715740 6186782))',25832));
...
Hope all this will help you help me along.