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
Hello Isidoro,
Can you share some information on the product version used in this scenario ?
A sample showing the behavior would be greatly appreciated and will allow me to examine the matter in more detail.
Yes after initializing igMap getZoomFromGeographic returns NaN on all fields... after 200ms works ok.
Thank you for your reply.
I have tested this and getZoomFromGeographic seems to be working as expected. Are you experiencing issues with the method not being available just after the initialization of the map? A small working sample illustrating the issue in practice would be greatly appreciate. Please note that when calculating the zoom area from coordinates it may be useful to set the width and height to 0 to zoom in on a particular area.
Please do not hesitate to contact me with any questions and updates.
But getZoomFromGeographic that I need for calculate the zoom doesn't function at this point.
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.