Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
770
Initialize igMap at 100% width and height, centered on a given geographical coordinates.
posted

Hello:

I want to intialize igMap at máximum space available on the Windows. I want initially the map is centered on a given groagraphicall coordinates.

 

I tried to precalculate free width and height, and set to igmap at inicialization, but map center position changes depending on the aspect ratio of the window. I can't convert coordinates using getZoomFromGeographic because igMap has not been initialized, too.

 

How can achieve this?

Thanks

Parents
  • 49378
    posted

    Hello Isidoro, Thank you for posting in the community !

     In this scenario it should be possible to calculate the position and set the window rectangle immediately after the definition for the map:

    $(function () { $("#map").igMap({ width: document.body.offsetWidth, height: document.body.offsetHeight, crosshairVisibility: "visible", verticalZoomable: true, horizontalZoomable: true, overviewPlusDetailPaneVisibility: "visible", overviewPlusDetailPaneBackgroundImageUri: "../../images/samples/maps/world.png", panModifier: "control", backgroundContent: { type: "openStreet" }, series: [{ type: "geographicSymbol", name: "worldCities", dataSource: data, latitudeMemberPath: "Latitude", longitudeMemberPath: "Longitude", markerType: "automatic", markerCollisionAvoidance: "fade", markerBrush: "#1B559D", markerOutline: "black", showTooltip: true, tooltipTemplate: "cityTemplate" }], windowResponse: "immediate", windowRect: { left: 1, top: 1, height: 1, width: 1 }, }); var zoom = $("#map").igMap("getZoomFromGeographic", { left: 0, top: 50, width: 3, height: 3 }); $("#map").igMap("option", "windowRect", zoom); });

    Attached is also a sample illustrating this in practice. Hope this helps. Please do not hesitate to contact me if you have any questions.

    geo-symbol-series (3).zip
Reply Children