ThinkGeo.com    |     Documentation    |     Premium Support

Difficulty displaying map (and features) in State Plane Coordinates

I have pasted below two (linked) pieces of code that cover my question.
Here I state the question in concept:

  1. 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)

  2. When I add a Point / Circle to an InMemoryLayer, and add it to the map; the map disappears, I only see the InMemoryLayer.

  3. 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)

  4. 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;
    }

Hi Kevin,

Thanks for reporting this issue.

I did some tests based on your code and reproduced your scene.

There are two reasons for this problem:

  1. The projection of ArcGISServerRestOverlay, we can set it as following code:

    ArcGISServerRestOverlay overlay = new ArcGISServerRestOverlay("sampleId", serverUri);
    overlay.Parameters.Add("BBOXSR", "32149");
    overlay.Parameters.Add("IMAGESR", "32149");
    overlay.Parameters.Add("format", "jpeg");
    

    But it does not work, we have encountered a bug. and our developers are working on it.

  2. There is an interaction between StaticOverlay and CustomOverlays.

When #1 is fixed, I will send you a sample to show how to use it.

Thanks,
Emil

Hi Kevin,

Sorry for delay, it had been fixed in the latest Daily Builds version 9.0.0.339(Production)& 9.0.388.0(Development) or higher version. Please get the fix from Product Center.

Attached is a sample which shows how to use ArcGISServerRestOverlay with 32149. Please check it out.
Mvc_Projection32149Sample.zip (164.2 KB)

And here is the major part, as shown below:

  1. Set the projection of ArcGISServerRestOverlay to 32149.

    ArcGISServerRestOverlay overlay = new ArcGISServerRestOverlay("sampleId", serverUri);
    overlay.Projection = "EPSG:32149";
    
  2. Add layers to map.
    The ArcGISServerRestOverlay is base overlay.
    The StaticOverlay is a shortcut way for you to add a LayerOverlay to the map. It can only be the base overlay.
    The map can contain multiple base overlays, though only one of them can be displayed at a time.
    Please add them as following:
    LayerOverlay layerOverlay = new LayerOverlay("DynamicOverlay"); layerOverlay.Layers.Add(AddMidPointCircle()); sampleMap.CustomOverlays.Add(overlay); sampleMap.CustomOverlays.Add(layerOverlay);

If something misunderstood here, please provide more information.

Thanks,
Emil

1 Like

Emil,
Thank you!
Very very helpful to see a clear example of projection use.
I had previously reviewed the projections sample code from earlier in the posts, and struggled to grasp some of the fine points.

With the bug fix, things appear to work fine now.

Hi Kevin,

Very glad to hear it works, Any questions please let us know.

Thanks,
Emil