180th meridian trouble

martin_dkmartin_dk Global Mapper UserPosts: 8
edited June 2010 in SDK
Hello

I'm using the sdk for rendering ecw data. I'm using GM_DrawLayerListToMemory and its working great. But only until I tried offsetting to the pacific area and I hit the 180th meridian. When the 180th meridian is part of my view, the rendering is obscured/not correct. If the 180th meridian is *just* outside the view to either side (east/west) its ok again. Example:

Im using another gis product for rendering the cyan shoreline. 179 and -179th meridian are green, 180th is red.

Here we see US west coast and part of the pacific, we see the 179 meridian and NOT the 180th - OK:
westu.png

Now offcentered just a bit to the west to reveal the 180th meridian, now rendering is broken:
westnotok.png

Same if im on eastern hemisphere. Here we just see the -179 meridian - OK:
eastk.png

Now offcentered to reveal 180th:
eastnotok.png


Whats the problem here?

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    That is strange, what SDK version are you using? Also, what projection are you rendering in (use GM_GetProjection if you aren't sure).

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • martin_dkmartin_dk Global Mapper User Posts: 8
    edited June 2010
    sdk version 1.33, mercator projection.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    Can you first try getting the latest SDK build from http://www.globalmapper.com/GlobalMapperSDK_v134_beta.zip to see if it has the same issue?

    Do you get the same results if you load your data into Global Mapper with the Mercator projection and pan until the anti-meridian is visible?

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • martin_dkmartin_dk Global Mapper User Posts: 8
    edited June 2010
    134 beta behaves the same. Global Mapper doesn't "wrap" around the 180th meridian (unless I'm missing an option somewhere):
    64992277.png

    So if you're zoomed in e.g. just left of 180th and wan't to see something on its right side, then you'd have to scroll aaaaall the way over there - not very usefull (and a showstopper for us):
    gm2y.png

    I'd expect it to wrap, or at least have an option to enable it. Like this google maps example.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    If you need to wrap the anti-meridian you have a few options. You can use a projection with the central meridian set to something other than 0, like -180, so that the discontinuity point is moved from +180/-180 to somewhere else. For example with a central meridian of -180 for the Mercator or Geographic projection, you would get a continuous map from 0 longitude through +180/-180 back to 0, rather than going from -180 to +180 continuously.

    The other option for true wrapping when you have more than the entire world in view is to draw multiple times for each separate section of the world. So if your map has the equivalent of -270 to +270, you would draw 3 times (using the appropriate different pixel rectangles and longitude coordinates converted to the appropriate valid range), once for +90 to +180 (the left side from -270 to -180), again in the middle from -180 to +180, then from -180 to -90 (the right side from +180 to +270).

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • martin_dkmartin_dk Global Mapper User Posts: 8
    edited June 2010
    ok, how do I set the central meridian to something else (than 0)?
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited June 2010
    You would use GM_SetProjection to modify the projection used. The central meridian is set using the CENTRAL_MERIDIAN parameter in your projection setup. For example here is a Mercator projection setup with a central meridian of -180.0:

    GM_Projection_t theProj;
    memset( &theProj, 0, sizeof theProj );
    theProj.mProjSys = GM_PRJ_MERCAT;
    theProj.mDatum = GM_DATUM_WGS_84; // or whatever datum you are using
    theProj.mUnits = GM_PRJ_UNIT_METERS;
    theProj.mNumAttrs = 1;
    theProj.mAttrList[0].mAttr = CENTRAL_MERIDIAN;
    theProj.mAttrList[0].mVal = -180.0;

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
Sign In or Register to comment.