Horizontal panning report - LogicalGeoPixel Questions.

Coordinator
Jan 23, 2009 at 8:16 AM
Edited Jan 23, 2009 at 8:17 AM
Ok spent some time seeing what we would need to do to support the infinite horizontal panning, the short answer is "a lot".

We really havn't yet sorted out which class is responcible for different part of the conversions and interactions between Logical, Pixel and Geo. Currently Map does everything with some inconsistancies directly accessing the MSI inside the tilesource. Conversions use a helper class that strangly has an instance of map, seems weird for the map class to call another class that then accesses a property from Map again.

So I got the 3 MSI controls rendering fine, look very good. The problem is its currently a nightmare to wire up panning, zooms, mouse events etc. Let alone the geometry. I've moved this task to a future version.
John.
Feb 11, 2009 at 12:59 PM
Edited Feb 11, 2009 at 1:01 PM
We have been able to simulate a shift to the right. This basically centers the map over the pacific ocean. To see the effect just add the provided code to your TileSource class. Perhaps making this a option in DeepEarth would be of use to others as well? Oh coarse there are problems that popup when allowing multipule views. One of which is how to handle polygons and lines that end up crossing over the edge of the map when the map shifts over. Anyway, thought I'd give you more to think about.

Thanks,
Ken

        protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, IList<object> tileSources

        {

            if (IsValidTileLevel(tileLevel))

            {

                int zoom = TileToZoom(tileLevel);

                tilePositionX += (int)Math.Pow((double)2, (double)(zoom - 1));

 

                if (tilePositionX >= (int)Math.Pow((double)2, (double)(zoom)))

                {

                    tilePositionX -= (int)Math.Pow((double)2, (double)(zoom));

                }

               tileSources.Add(GetTile(tileLevel, tilePositionX, tilePositionY));

Developer
Feb 12, 2009 at 12:32 AM
I looked at this code and I wondered what would happen to the coordinate system, 

e.g. you are taking a tile of coords x,y and placing a different tile there

so the coords do not match up anymore...

to test I added the code in the previous post and then I run the project and on the "SideBar" I click the "Zoom to Brisbane" button and I zoom to somewhere off the east coast of Africa, not to Brisbane, Australia
Developer
Feb 12, 2009 at 12:36 AM
Edited Feb 12, 2009 at 12:37 AM
might it be better to offset a second etc map by using "Map.GeoCenter" property?

this preserves the coord system, or have I missed the point of what you are trying to achive here?


        public Page()
        {
            InitializeComponent();
 
            // Choose your startup provider
            map.BaseLayer.Source = new VeTileSource(VeMapModes.VeHybrid);
            // map.BaseLayer.Source = new OsmTileSource(OsmMapModes.Mapnik);
            // map.BaseLayer.Source = new OamTileSource(OamMapModes.OAM);
 
            GeometryLayerTest();
 
            GeometryAnchorTest();
 
            map.Events.MapLoaded += Events_MapLoaded;
        }
 
        void Events_MapLoaded(DeepEarth.Map _Map, DeepEarth.Events.MapEventArgs args)
        {
            map.GeoCenter = new Point(-134.5, -27.5);
        }


Feb 12, 2009 at 4:57 PM
Edited Feb 12, 2009 at 4:58 PM
The coordinate system needs to be reworked for this type of offsetting.  In coordinate transform, the following code helps 2/3 of the way.  I'm going to look into other ways to implement this but this seems to be on the right track:

        public Point GeoToLogical(Point geographicPoint)

        {

            if (_Map.Offset == true)

            {

                double geographicXOffset = geographicPoint.X;

                geographicXOffset += 180;

                if (geographicXOffset > 180)

                {

                    geographicXOffset -= 360;

                }

                geographicPoint.X = geographicXOffset;

            }

            Point logical = this.GeographicToLogical(_Map.SpatialReference, geographicPoint);

            return logical;

        }

        public Point LogicalToGeo(Point logicalPoint)

        {

            if (_Map.Offset == true)

            {

                double logicalXOffset = logicalPoint.X;

                logicalXOffset -= 0.5;

                if (logicalXOffset < -0.5)

                {

                    logicalXOffset += 1.0;

                }

                logicalPoint.X = logicalXOffset; 'this isn't quite right yet

            }

            Point geographic = this.LogicalToGeographic(_Map.SpatialReference, logicalPoint);

            return geographic;

        }


Coordinator
Feb 12, 2009 at 5:26 PM
Very interesting idea. This doesn't seem to exactly be fluid infinite panning, but does achieve the primary goal of being able to choose the map center which is really the main objective anyway. We should probably consider whether the SpatialReference.CentralMeridian pararameter should drive this.
Feb 13, 2009 at 1:27 PM
Driving the coords off a central setting sounds like the way to go. I'm not sure you could use it to shift the tiles though. Since DeepEarth starts with two columns of tiles you can only have two possible center points. One with the tiles arranged normally and another with the tiles swapped. However, the routines that would manage the offset could also be responable to updating the CentralMeridian.
Coordinator
Feb 13, 2009 at 2:02 PM
Edited Feb 13, 2009 at 2:10 PM
Good point.  We are constrained, of course, by how the tiles are cut by the tile provider.  One workaround for this is to limit MinZoom to accomodate a choosen CenterMeridian.  For example, if 90E were the desired center, setting MinZoom to 3 would accomodate this center line since this level has 4x4 tiles.  MinZoom of 4 would allow 8 possible start meridians, 5 - 16, and so on.  So if it were important enough to trade off MinZoom for the chosen center Meridian, the designer could choose to do it.
Mar 9, 2010 at 4:15 PM

I was just wondering where this part of the project has been left off.

Coordinator
Mar 18, 2010 at 4:17 AM

Defn posible to do this but needs a bunch of work and we don't have anyone with free time looking at this. If anyone is looking for a good challenge I can send you a tonne of ideas and the working prototype code.