I have pasted below two (linked) pieces of code that cover my question.
Here I state the question in concept:
-
I have the sample map displaying properly - when I select GeographicalUnit --> Decimal Degrees. (I’ve set the boundaries to the Lat/Long of Washington State South Coordinates (EPSG:32149)
-
When I add a Point / Circle to an InMemoryLayer, and add it to the map; the map disappears, I only see the InMemoryLayer.
-
When I change GeographicalUnit to Meters, and enter Meter Coordinates for Washington State South (EPSG:32149) - I see nothing (well, actually I see the “Alaska” label in the lower right corner)
-
Again, when in Meters, and I add a Point/Circle - I only see the point/circle - not the map.
I’m clearly missing a concept here in terms of coordinate conversion, or setting display coordinates versus data source coordinates.
The reason for needing this, is we have a large database of items to display on the map, which are in the database with Washington State coordinates, and we do want to maintain the correct linear distance relationships within that data.
Can anyone offer some tips?
public Map GetSampleMap()
{
//Setup a map canvas
ThinkGeo.MapSuite.MvcEdition.Map sampleMap = new ThinkGeo.MapSuite.MvcEdition.Map("SampleMap",
new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 500);
sampleMap.MapBackground = new BackgroundLayer(new GeoSolidBrush(GeoColor.StandardColors.White));
//Point to the server
Uri serverUri = new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/export");
ArcGISServerRestOverlay overlay = new ArcGISServerRestOverlay("sampleId", serverUri);
overlay.Parameters.Add("format", "jpeg");
//Add the background overlay
sampleMap.CustomOverlays.Add(overlay);
//////Everything above here is fine
//////This example midPoint in decimal degrees works
sampleMap.CurrentExtent = new RectangleShape(-123.6, 47.6, -115.6, 45.5);
sampleMap.MapUnit = GeographyUnit.DecimalDegree;
////////This example is what I want to get working - with point data entered in Washington State South Coordinates (EPSG:32149)
////////I'm sure at least I'm missing conversion from (90N 0W) (roughly - 13879871 meters x; 5733278 meters y)
////////But I don't know how to get the map to use this coordinate system to display properly, so we can draw known shapes
////////based on EPSG:32149
//sampleMap.CurrentExtent = new RectangleShape(187754.6365, 259585.0321, 781043.7173, 30497.7688); //32149 projection boundaries in meters
//sampleMap.MapUnit = GeographyUnit.Meter;
//////Below here is part 2 of the question
////////Also here, leaving the code line commented out (Decimal Degrees), I see the state;
////////but if I uncomment it, I only see a white box with my midPoint circle drawn (Whether Decimal Degrees, or Meters)
////////Add the layer to the map
//sampleMap.StaticOverlay.Layers.Add(AddMidPointCircle());
//return the map
return sampleMap;
}
public InMemoryFeatureLayer AddMidPointCircle()
{
//Setup In Memory Feature layer for the mid point
InMemoryFeatureLayer midPointLayer = new InMemoryFeatureLayer();
midPointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle =
new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(new GeoColor(50, GeoColor.GeographicColors.DeepOcean)),
new GeoPen(GeoColor.GeographicColors.DeepOcean), 20);
midPointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
//////When the Geographical Unit is Decimal Degrees Keep this line uncommented
Feature circleInWashington = new Feature(new Vertex(-119.6, 46.55), "MidPoint", new Dictionary<string, string>());
////////When the Geographical Unit is Meters Keep this line uncommented
//Feature circleInWashington = new Feature(new Vertex(484399.1769, 145041.4004), "MidPoint", new Dictionary<string, string>());
//Add the midPoint circle to the Feature Source
midPointLayer.Open();
midPointLayer.FeatureSource.BeginTransaction();
midPointLayer.FeatureSource.AddFeature(circleInWashington);
midPointLayer.FeatureSource.CommitTransaction();
midPointLayer.Close();
return midPointLayer;
}