DefineIcon in Geo Web Publisher

MapViewer has DefineIcon and CreateViewIndependantIconElement functions. Has anyone used these before that can explain how it works?

Any help very much appreciated

Parents
  • Those two methods are used to define icons on the editable/redline overlay. (i.e. Similar to CreatePolygonElement). So to create an icon, you first need to call 'DefineIcon' with a pixel array, and then you will get in return an Icon defintion ID. To actually create instances, you have to call 'CreateViewIndependentIconElement' and specify the icon center the the previously defined icon def. ID.

    Regards,

    Michel
  • Yes, i understand.

    i use the method like this:

    var points =[0,178, 249, 12];


    var pointsVBArrayIcon = MapViewerControl.VBArrayFromJavaScriptArray(points);

    parent.document.getElementById('Default_main_frame_0').contentWindow.document.getElementById('MapViewerControl').CreateViewIndependentIconElement(pointsVBArray, DefineIcon (1200, 1200, pointsVBArrayIcon));

    First, dont show me nothing in geo web publisher. 

    Second, i cant choose my image or something to show.

    third, don't you have an example of how to use this functions CreateViewIndependentIconElement() defineIcon() ??

    thanks

Reply
  • Yes, i understand.

    i use the method like this:

    var points =[0,178, 249, 12];


    var pointsVBArrayIcon = MapViewerControl.VBArrayFromJavaScriptArray(points);

    parent.document.getElementById('Default_main_frame_0').contentWindow.document.getElementById('MapViewerControl').CreateViewIndependentIconElement(pointsVBArray, DefineIcon (1200, 1200, pointsVBArrayIcon));

    First, dont show me nothing in geo web publisher. 

    Second, i cant choose my image or something to show.

    third, don't you have an example of how to use this functions CreateViewIndependentIconElement() defineIcon() ??

    thanks

Children
  • The first two parameters of DefineIcon are the width/height in pixels (so 1 pixel =  4 bytes).  Are you really trying to create an independent 1200x1200 pixels icon?  Unfortunately there are no service to read directly a image file, you must provides the RGBA data of each pixel in a bitmap array.

    Here is a sample icon definition that is 16x16 pixels:

        var iconSize = 16;
        var iconData = [255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   148, 174, 201, 200,   135, 157, 206, 200,
                        135, 150, 209, 200,   158, 179, 210, 200,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        133, 159, 192, 200,    46,  87, 139, 200,    23,  75, 135, 200,     0,  47, 107, 200,
                         15,  64, 120, 200,    16,  48,  87, 200,    31,  56,  87, 200,   144, 160, 176, 200,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,    95, 130, 172, 200,    19,  74, 154, 200,
                          0,  55, 153, 200,     0,  68, 161, 200,     0,  80, 153, 200,     0,  60, 119, 200,
                         14,  64, 117, 200,     0,  32,  76, 200,    39,  68,  98, 200,   132, 150, 164, 200,

                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   150, 181, 202, 200,     0,  60, 122, 200,     0,  67, 158, 200,
                         16, 105, 205, 200,     0,  84, 177, 200,     5,  86, 165, 200,     0,  74, 141, 200,
                          1,  62, 127, 200,    12,  67, 123, 200,     0,  17,  57, 200,     8,  36,  58, 200,

                        173, 187, 196, 200,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 225, 255,   0,    35,  81, 131, 200,     8,  87, 154, 200,    15, 109, 181, 200,
                        112, 199, 255, 200,    91, 162, 228, 200,     0,  54, 127, 200,     1,  56, 136, 200,
                          0,  41, 112, 200,     0,  59, 119, 200,     0,  31,  77, 200,     0,  25,  53, 200,

                         56,  75,  90, 200,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        169, 194, 251, 200,     0,  53, 120, 200,     4,  91, 162, 200,    32, 126, 188, 200,
                        152, 226, 255, 200,   126, 178, 226, 200,    37,  78, 142, 200,     6,  48, 130, 200,
                          3,  61, 125, 200,     7,  59, 116, 200,     6,  50,  95, 200,     7,  40,  71, 200,

                          0,  11,  28, 200,   151, 160, 169, 200,   255, 255, 255,   0,   255, 255, 255,   0,
                        119, 148, 190, 200,    11,  66, 130, 200,     0,  72, 152, 200,    10,  96, 173, 200,
                         58, 120, 181, 200,    15,  61, 111, 200,    15,  64, 123, 200,     0,  47, 119, 200,
                          0,  38,  95, 200,     0,  34,  84, 200,     0,  35,  74, 200,     3,  33,  61, 200,

                          7,  26,  43, 200,   133, 143, 153, 200,   255, 255, 255,   0,   255, 255, 255,   0,
                        141, 170, 186, 200,     0,  56, 107, 200,     0,  61, 150, 200,     0,  66, 166, 200,
                         11,  67, 152, 200,     9,  57, 121, 200,     0,  52, 111, 200,     0,  63, 125, 200,
                         20,  56, 106, 200,     0,  28,  73, 200,     6,  39,  74, 200,     0,  21,  48, 200,

                          0,  16,  33, 200,   116, 126, 138, 200,   255, 255, 255,   0,   255, 255, 255,   0,
                        156, 182, 215, 200,    11,  48,  90, 200,     0,  50, 106, 200,     0,  67, 135, 200,
                          0,  55, 125, 200,     2,  63, 130, 200,     0,  46, 103, 200,    13,  54, 106, 200,
                          6,  49,  92, 200,     0,  21,  62, 200,     5,  38,  71, 200,     0,  20,  46, 200,
                         16,  29,  45, 200,   138, 142, 151, 200,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,    40,  70, 106, 200,     0,  42,  91, 200,    17,  76, 136, 200,
                          0,  58, 123, 200,     0,  47, 108, 200,     0,  36,  90, 200,     0,  36,  85, 200,
                          0,  33,  74, 200,     0,  35,  73, 200,     2,  31,  61, 200,     0,  17,  41, 200,
                         41,  53,  67, 200,   155, 158, 165, 200,   255, 255, 255,   0,   255, 255, 255,   0,

                        240, 249, 255, 200,   147, 165, 189, 200,    22,  55,  90, 200,     0,  14,  61, 200,
                          0,  47, 100, 200,    12,  59, 111, 200,     1,  42,  88, 200,     7,  42,  84, 200,
                          5,  38,  71, 200,     0,  29,  59, 200,     0,   7,  33, 200,    37,  54,  72, 200,
                        108, 118, 130, 200,   160, 163, 168, 200,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,   255, 255, 255,   0,   136, 154, 176, 200,    15,  44,  76, 200,
                          0,  32,  70, 200,     0,  32,  70, 200,     0,  27,  65, 200,     0,  21,  55, 200,
                          0,  13,  39, 200,     0,  20,  44, 200,    10,  27,  45, 200,   106, 118, 132, 200,
                        161, 168, 176, 200,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   167, 183, 199, 200,
                         54,  72,  96, 200,     0,  13,  38, 200,    18,  38,  63, 200,     0,  18,  43, 200,
                         25,  38,  54, 200,    74,  86, 100, 200,   105, 115, 127, 200,   162, 169, 177, 200,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        203, 210, 220, 200,   140, 148, 161, 200,   136, 145, 160, 200,   110, 122, 138, 200,
                        134, 138, 147, 200,   146, 149, 156, 200,   153, 156, 161, 200,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,

                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,
                        255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0,   255, 255, 255,   0];

    That said, view independent icon is a very old technology.  You might want to look into defining a point layer with a pixel symbology instead.

    Regards,

    Michel

  • Hi, Thanks for the info,

    I will try that example, and i will view info of defining point layer with a piel simbology.

    Only i need is mark the map in a point with an image.

    like google maps does.

    I can center the map in position x,y with the method CenterAroundPoint() but i cant mark that point. 

    Any example of how to mark is welcome,

    Thank you so much for the help

  • Sorry but doesnt work for me. Showing nothing in the map. I still try. Need one way to mark the map.

    Today i will contact the Bentley support. 

    Thanks anyway.