Rendering Vector Layer to Raster Layer

John LeeJohn Lee Global Mapper UserPosts: 12
edited February 2010 in SDK
Is there a fast way to render a vector layer (all area features / etc...) to a custom created raster layer?

I have to do some analysis on the existence of hydrology (Which is loaded in as vector data), and would rather have immediate access to a grid of values rather than having to go through the GM_FindNearestFeatures( ) function on each point I want to analyze.

Thanks,
John

Comments

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2010
    John,

    You could use GM_DrawLayerListToMemory to draw the data to a memory buffer, then create your custom raster layer from that (or just access your memory buffer directly).

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    support@globalmapper.com
  • John LeeJohn Lee Global Mapper User Posts: 12
    edited February 2010
    Thanks for the tip,

    I was reading the documentation:

    "The aspect ratio of the screen pixels will be maintained, so slightly more of the world bounds than specified may be drawn."

    I'm not sure if this will be an issue yet or not. The layer I'm trying to render to is currently square (although could be anything) and also at a higher resolution that a normal computer monitor. I'll give it a try and see what happens.

    I was also looking at GM_GenerateElevationGrid, not sure if that would work for me either as there is currently no elevation associated with the vector data.
  • John LeeJohn Lee Global Mapper User Posts: 12
    edited February 2010
    Looks like the aspect ratio thing can be overcome with GM_DrawFlags_DontMaintainAspectRatio as a draw flag.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2010
    You could also make your memory buffer have the same (or very close to the same) aspect ratio as the layer that you are rendering to avoid the aspect ratio issue altogether, or you can just pass the flag that you mentioned and stretch the results.

    Let me know if I can be of further assistance.

    Thanks,

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