Focal Point
[CLOSED] initPos in a Bubble Map

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2867059096

December 03, 2018, 04:55 AM
Danny-SRL
[CLOSED] initPos in a Bubble Map
Has anybody used the map properties to control the center and zoom level of a map?
According to the manual:
quote:

By default, the map viewer determines a bounding box that completely encapsulates all
the markers in your data source and chooses a zoom level that nicely bounds your data.

Instead, you can specify your own initial position and initial zoom level in the map properties
included in your request.


The manual says to use:
  
initPos:{
center:[latitude, longitude],
level: zoom}


Here is what I entered:
  
"mapProperties": {
   "engine": "leaflet",
      "leafLet":{
         "initPos": {
             "center": ["31.99", "34.96"],
             "level": "4"
         }
      }
},

and I was IGNORED Mad

Any ideas?

This message has been edited. Last edited by: FP Mod Chuck,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 03, 2018, 08:23 AM
BabakNYC
I think initPos requires numbers not in double quote.

[31.99, 34.96]

  
"mapProperties": {
"engine": "leaflet",
"leaflet": {
"initPos": {
"center": [31.99, 34.96],
"level": 4
},

This message has been edited. Last edited by: BabakNYC,


WebFOCUS 8206, Unix, Windows
December 03, 2018, 01:20 PM
Danny-SRL
Tried it. Same output. Ignored Mad Mad


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 03, 2018, 01:32 PM
BabakNYC
I just tried this and it seems to work for me. It's an example right out of the doc with your Lat/Long. Can you test it on your version?

 
GRAPH FILE wf_retail_lite
SUM MIN.CITY_POPULATION
BY BRANDTYPE
BY STATE_PROV_LATITUDE
BY STATE_PROV_LONGITUDE   
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET GRMULTIGRAPH 1  
ON GRAPH SET GRLEGEND 0  
ON GRAPH SET GRXAXIS 2   
ON GRAPH SET LOOKGRAPH BUBBLEMAP
ON GRAPH SET STYLE *
*GRAPH_JS
"bubbleMarker":{"maxSize":"10%"},
"mapProperties": {
  "leaflet": {
   "initPos": {
    "center": [31.99, 34.96],
     "level": 4
              },

   "overlayLayers": [{
      "title": "US",
      "layerInfo": {
       "type": "regions"
                },
      "type": "latlng",
       "url": function(){return tdgchart.getScriptPath() + 'map/US.json'}
            }],
   "baselayers": [{
    "title": "ArcGIS_World_Street_Map",
    "layerInfo": {
     "maxZoom": 16,
     "attribution": function() {  return "&|copy; <a target='_blank' href='http://www.InformationBuilders.com'>Information Builders</a> | " + "Map Tiles: &|copy; Esri"; }
                },
     "url": function() { return 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}'; }
            }]
    }
}
*END
ENDSTYLE
END 



WebFOCUS 8206, Unix, Windows
December 03, 2018, 02:15 PM
Danny-SRL
Babak,
Thanks.
Yes it works here, which would mean that I have to add to my example some of your "layers".

I'll give it a try.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 04, 2018, 02:46 AM
Danny-SRL
Hi Babak,
I tried using your *GRAPH_JS with my example. Nothing doing.
So here is my example. Could you try it on your machine?
  
-SET &ECHO=ALL;
-* File isrmap02.fex
FILEDEF ISR DISK ISR.TXT
EX -LINES 8 EDAPUT MASTER,ISR,C,MEM
FILENAME=isr, SUFFIX=FIX
  SEGMENT=SEG1, SEGTYPE=S0
    FIELDNAME=COUNTRY, ALIAS=COUNTRY, USAGE=A8, ACTUAL=A8, $
    FIELDNAME=CITY, ALIAS=CITY, USAGE=A10, ACTUAL=A10, $
    FIELDNAME=LAT,  ALIAS=LAT,  USAGE=A10, ACTUAL=A10, $
    FIELDNAME=LON, ALIAS=LON, USAGE=A9, ACTUAL=A9, $
    FIELDNAME=POPULATION,  ALIAS=POPULATION,  USAGE=I8, ACTUAL=A8, $
-RUN
-WRITE ISR ISRAEL  Ra`anana  32.184448 34.870766   80000
-WRITE ISR ISRAEL  Ashdod    31.801447 34.643497  220000
-WRITE ISR ISRAEL  Nazareth  32.699635 35.303547   76000
-WRITE ISR ISRAEL  Bat Yam   32.017136 34.745441  130000
-WRITE ISR ISRAEL  Tel Aviv  32.109333 34.855499  430000
-WRITE ISR ISRAEL  Haifa     32.794044 34.989571  278000
-WRITE ISR ISRAEL  Karmiel   32.919945 35.290146   50000
-WRITE ISR ISRAEL  Herzliya  32.166313 34.843311   94000
-WRITE ISR ISRAEL  Rehovot   31.894756 34.809322  131000
-WRITE ISR ISRAEL  Jerusalem 31.771959 35.217018  858000
-WRITE ISR ISRAEL  Eilat     29.557765 34.951918   48000
-RUN
-* File: IBFS:/localhost/EDA/EDASERVE/APPPATH/danny/Chart1.fex Created by WebFOCUS AppStudio
-*
-* I erased the GRAPH comments so as not to clutter this post
-*
-*IA_GRAPH_BEGIN
-*Do not delete or modify the comments below
-*COMPONENT=Define_isr
DEFINE FILE isr
 LAT_LON_POINT/A150=GIS_POINT ( '4326' , LON , LAT ) ;
END
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE isr
-* Created by Info Assist for Graph
SUM POPULATION AS 'Population'
POPULATION AS ''
FST.CITY AS 'City'
BY LAT_LON_POINT
WHERE CITY CONTAINS 'Jerusalem' OR 'Nazareth';
HEADING
"Cities and Population"
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET AUTOFIT ON
ON GRAPH SET GRWIDTH 1
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET LOOKGRAPH BUBBLEMAP
ON GRAPH SET AUTOFIT RESIZE
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END
INCLUDE=Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, CHART-LOOK=com.esri.map, $
TYPE=DATA, COLUMN=N2, BUCKET=color, $
TYPE=DATA, COLUMN=N3, BUCKET=size, $
TYPE=DATA, COLUMN=N4, BUCKET=tooltip, $
TYPE=HEADING, JUSTIFY=CENTER, $
TYPE=HEADING, LINE=1, ITEM=1, OBJECT=TEXT, FONT='ARIAL', SIZE=12, COLOR=RGB(32 0 32), STYLE=NORMAL, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setGradientPinLeftColor0(getLegendArea(),new Color(13,5,255));
setGradientPinRightColor0(getLegendArea(),new Color(13,5,255));
setGradientPinLeftColor2(getLegendArea(),new Color(13,5,255));
setGradientPinRightColor2(getLegendArea(),new Color(13,5,255));
setGradientPinLeftColor1(getLegendArea(),new Color(255,0,255));
setGradientPinRightColor1(getLegendArea(),new Color(255,0,255));
setFillType(getLegendArea(),2);
setGradientNumPins(getLegendArea(),3);
setGradientPinPosition0(getLegendArea(),0.0);
setGradientPinPosition1(getLegendArea(),0.5);
setGradientPinPosition2(getLegendArea(),1.0);
setFillColor(getLegendArea(),new Color(255,255,255));
*GRAPH_JS_FINAL
"extensions": {
    "com.esri.map": {
        "overlayLayers":             [
                {
                    "ibiDataLayer": {
                        "map-geometry": {
                            "map_by_field": "LAT_LON_POINT"
                        }
                    }
                }
            ],
        "baseMapInfo": {
            "customBaseMaps":                 [
                    {
                        "ibiBaseLayer": "gray"
                    }
                ]
        }
    }
},
-* Added the following to center the map (doesn't work)
"mapProperties": {
   "engine": "leaflet",
      "leafLet":{
         "initPos": {
             "center": [31.99, 34.96],
             "level": 4
         }
      }
},
-* Added the following for coloring the bubbles (works)
"yaxis": {
    "mode": "color",
    "colorScale": {
        "colors": ["red", "yellow", "green"]
-*		"red", "orange", "yellow", "green", "blue", "indigo", "purple"]
    }
},
-* Added the following for bubble size (works)
"bubbleMarker": {
   "maxSize": 35
},
-* Added the following for data labels (works)
"dataLabels": {
   "visible": "true",
   "font": "8pt Sans-Serif",
   "color": "black",
   "numberFormat": {
      "grouping": "K"}
},
"agnosticSettings": {
    "chartTypeFullName": "Bubblemap"
}
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH

When I run this the map is reduced to show only the 2 points, instead of being centered and showing all the country. When I comment out the line the WHERE CITY line I get the whole country.
Thanks again for taking the time.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 04, 2018, 12:21 PM
BabakNYC
I couldn't get your data to load so I put it in Excel and uploaded it into SQL Server. Other than that and switching the INCLUDE=Warm to INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$

I kept everything else the same and I get a map with the two bubbles with Jerusalem in the center of the map.


WebFOCUS 8206, Unix, Windows
December 05, 2018, 05:08 AM
Danny-SRL
This what I get when the condition is set:
WHERE CITY CONTAINS 'Jerusalem' OR 'Nazareth';

Without the condition it is:
All Cities

What I hoped for the first map was to have the second map with just the two cities.
Is this what you get?
If so, could it be the version (8.2M)? Running under AppStudio? Any other idea?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 05, 2018, 06:42 AM
BabakNYC
Without the WHERE I get a whole lot of other bubbles but the center of the map is still the same zoom location. Can you download and install 8203 on a test machine? This seems to be working for me.


WebFOCUS 8206, Unix, Windows
December 05, 2018, 06:47 AM
Danny-SRL
Thanks!
I'll ask my manager for the 8203 version.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

December 05, 2018, 09:31 AM
BabakNYC
Well, I'd do that and at the same time open a case with IB tech support to get to the bottom of this. 8.202 isn't that old and it should respect the initial position you're setting. Your finding might be something they've already fixed.


WebFOCUS 8206, Unix, Windows