Native projection of layer on loading

sri
sri Global Mapper User
edited August 2009 in SDK
I am having problems determining the native projection of a layer on loading.

For example, I am trying to load a TIFF file using the GM_LoadFlags_UseDefaultPos flag, I then call GM_GetLayerInfo and check the NativeProj property, it returns the following projection data; UTM/WGS84/Meters. However, when I load the same TIFF file and a corresponding world file is present, the NativeProj data changes to Geographic/WGS84/Arc Seconds.

I don't understand how this is possible since neither the TIFF file nor the corresponding world file contain projection data.

I am trying to achieve the functionality that exists in Global Mapper v10.02 where, on loading a TIFF file, when a corresponding world file is also present, a dialog pops up and requests projection information.

I am having difficult achieving this as I can not determine when a loaded layer has unknown/default projection data.

Many thanks in advance.

Comments

  • global_mapper
    global_mapper Administrator
    edited August 2009
    If you are also specifying to select a default projection, that default projection will be chosen based on the coordinates available. So if your world file has coordinates that are all valid lat/lon values, a Geographic projection will be chosen by default. Otherwise UTM will pop up.

    The user should be asked for a projection unless you are also passing in the flag to use the default projection. You can also have your own projection selection be called rather than the built-in projection selection dialog by using the GM_SetQueryProjectionCallback function.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • sri
    sri Global Mapper User
    edited August 2009
    Thanks for your useful post Mike.

    I just wish to clarify one more point. When loading a GeoTIFF file in GlobalMapper v10.02 the user is not prompted to input the projection. Whereas, on opening a TIFF file with corresponding world file, the user is prompted to input the projection.

    How do you determine whether to request projection data from the user or not? (I am using the mUsedDefaultPosition flag to check if the image requires rectification, and it is false for both cases stated above.)

    Many thanks.
  • global_mapper
    global_mapper Administrator
    edited August 2009
    If Global Mapper cannot automatically determine the projection to use from any source, then the user is prompted as a last resort. Global Mapper will check for internal GeoTIFF information, then external sources like a PRJ file, MapInfo .tab file, Ozi .map file, and several other possible sources of projection information, then finally ask the user.

    Note that a world file just contains a mapping of pixel coordinates to some other coordinate space. It does not specify the projection of that new coordinate space. If you pass in the GM_LoadFlags_UseDefaultProj flag when loading then a default projection will be used rather than prompting the user.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com