MapInfo Pro

 View Only
  • 1.  Is it possible to automate line of sight raster function?

    Posted 05-30-2019 06:41

    'Line of sight' raster function is very useful when working with LIDAR raster data plot but I'd like to automate this function to crunch through a table of vector lines one by one and give me a yes/no validation of line of sight for each set of points. I can do this manually one at a time but would like to automate for a large data set. Anyone familiar with this and any ideas if/how this could be achieved?

    ------------------------------
    Dave Townend
    Wireless Research
    BT Group plc
    London
    ------------------------------


  • 2.  RE: Is it possible to automate line of sight raster function?

    Posted 06-02-2019 20:07
    The "Viewshed" tool (available via the Raster ribbon for users of MapInfo Pro Advanced) performs "one to many" style "line of sight" analysis and presents the result as a raster where the value of each raster cell provides information about what an observer placed at the centre of that cell can see. This might not be exactly what you are looking for. Here are some notes I have previously prepared about this operation in case it helps.

    A viewshed operation seeks answers to the question "from where can I be seen?" or "what can I see from here?". So we seek to answer questions about the visibility of a small number of target locations at a large number of observation positions. The operation requires the user to supply the location of the targets and a DTM or DSM raster representing the terrain surface. The observation positions are located at the centre of every cell in the terrain raster.

    One application might be the placement of a wind turbine. The operation can determine from where those turbines are visible. Another application is the placement of a mobile phone tower. The application can determine what areas can be serviced by that phone tower.

    In the simplest case we have a single target and multiple observers. The target is placed at some position within the bounds of the DSM and the computer will simulate an observer at the centre of every grid cell surrounding the target, out to some specified radial distance. The algorithm places both the target and the observers at the local height of the terrain. Both the target and the observers can then be offset by some height above the actual terrain. With this arrangement we can answer the following questions –

    ·         What observers can see the target?
    o    The result is recorded for each observer as a Boolean value – visible or invisible.
    o    The result also answers the question – what observers can be seen from the target?

    ·         How much higher must each observer be to see the target?
    o    The result is recorded for each observer as either zero or a positive value representing the vertical distance the observer must be raised to be able to sight the target.

    ·         For each observer, how much higher must the target be to be seen?
    o    The result is recorded for each observer as either zero or a positive value representing the vertical distance the target must be raised to be sighted by the observer.

    ·         For each observer, how much lower could the target be and still be seen?
    o    The result is recorded for each observer as either zero or a positive value representing the vertical distance the target can be lowered and still be sighted by the observer.

    In addition to having multiple observers, we can also have multiple targets. In this scenario we can answer the following questions –

    ·         How many targets can be seen by each observer?
    o    The result is recorded for each observer as an integer count of the number of visible targets.
    o    A calculator operation on this result can answer the question – what observers can sight a target?
    o    A calculator operation on this result can answer the question – what observers can sight at least N targets?
    o    A calculator operation on this result can answer the question – what observers can sight all targets?

    ·         How much higher must each observer be to see at least one target?
    o    The result is recorded for each observer as either zero or a positive value representing the vertical distance the observer must be raised to be able to sight a target.

    ------------------------------
    Sam Roberts
    Engineer, MapInfo Pro Advanced (Raster)
    Australia
    ------------------------------



  • 3.  RE: Is it possible to automate line of sight raster function?

    Employee
    Posted 06-02-2019 20:40
    Hi Dave,

    This is possible, but requires some scripting outside MapInfo Pro using the Raster API which comes with MapInfo Pro Advanced.  MapInfo Pro Advanced includes a .NET based API that allows you to write custom applications or functions that take advantage of MapInfo Pro Raster to automate certain tasks. 

    This does require some knowledge of MS.Net to use the API, but some good sample code is included in the MapInfo installation. 

    The sample code and documentation is in your MapInfo installation folder at \Raster\Documentation\API
    The MapInfo.RasterEngine.Analysis.Samples.cs code file has some LineOfSight sample methods.


    You can also take a look at this article by @Peter Møller​ to get an idea of what's possible

    http://support.pitneybowes.com/SearchArticles/apex/VFP05_KnowledgeWithSidebarHowTo?id=kA180000000CtsGCAS&lang=en_US&popup=false



    ------------------------------
    Stephen White
    Presales Director
    Brisbane, Australia
    ------------------------------



  • 4.  RE: Is it possible to automate line of sight raster function?

    Posted 07-01-2019 07:49
    Thanks guys really helpful response. I went with the viewshed option in the end and did logical operation on the multile endpoints if they were in the viewshed raster. Not ideal as had to do this for multiple end point heights but quicker than going down the api route for more accurate individual line of sight checks.

    ------------------------------
    Dave Townend
    Wireless Research
    BT Group plc
    London
    ------------------------------



  • 5.  RE: Is it possible to automate line of sight raster function?

    Posted 09-23-2020 06:39
    Revisiting this thread with a .NET API approach and have come across a problem with calling my .NET method from mapbasic which could do with some expert help. I'm building on the raster engine analysis examples and Peter HM's excellent articles and  RasterTools code. The line of sight example method is expecting a public struct argument for source and destination viewpoints (3 parameters x, y and height offset). How do I support this in my mapbasic call?

    Have tried to simplify the example below, clearly lots of things could be wrong here (not least my latest attempt using trying to pass a custom variable type to the call expression in mapbasic) but any pointers or examples on general approach to this in mapbasic would be welcome!

    C# line of sight method code
     
    .def file

    mapbasic application code


    ​(p.s same original poster but with temp account)

    ------------------------------
    Dave Townend
    Knowledge Community Shared Account
    ------------------------------



  • 6.  RE: Is it possible to automate line of sight raster function?

    Employee
    Posted 09-23-2020 07:33
    One option would be to pass the parameters for the viewpoints as three individual parameters or as an array of three values from MapBasic to your .NET method.

    In the .NET method, you can then assign the value to the struct.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 7.  RE: Is it possible to automate line of sight raster function?

    Posted 09-23-2020 10:26
    Thanks, that makes sense and seems to work ok - I just extended the parameter sets and did the assignments in .NET.

    ------------------------------
    Dave Townend
    Knowledge Community Shared Account
    ------------------------------