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, 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.
But getZoomFromGeographic that I need for calculate the zoom doesn't function at this point.
Hello Isidoro,
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.
Yes after initializing igMap getZoomFromGeographic returns NaN on all fields... after 200ms works ok.
Hi, I realize this is an old thread, but I'm running into a similiar issue with Q2 2014. Basically I would like to load a United States Map and then show individual states when the user selects from a list. I'm getting this error - Uncaught TypeError: Cannot read property '__y' of undefined
$(function () {
$("#map").igMap({ width: "700px", height: "500px", windowRect: { left: 1, top: 1, height: 1, width: 1 }, overviewPlusDetailPaneVisibility: "visible", overviewPlusDetailPaneBackgroundImageUri: "http://www.igniteui.com/images/samples/maps/world.png", series: [{ type: "geographicShape", name: "worldCountries", markerType: "none", shapeMemberPath: "points", shapeDataSource: '/images/states/usa_states.shp', databaseSource: '/images/states/usa_states.dbf', opacity: 0.8, outlineThickness: 1, showTooltip: true, tooltipTemplate: "geoShapeTooltip" }], });
$("#map").igMap("flush");
var zoom = $("#map").igMap("getZoomFromGeographic", { left: 0.26, top: 0.33, width: 0.1, height: 0.12 });
$("#map").igMap("option", "windowRect", zoom);
// calculateMapWindow(2, 1); });
Hello Lorenzo,
Thank you for your patience.
I have received word from our engineers that some changes were made in versions 13.2 and on to the igChart and igMap which defer part of their initialization for performance reasons. Therefore in this scenario the suggested approach would be to call:
prior to calling the methods requiring the aspect ratio of the map to be calculated. Our engineers are continuing to look into this issue and will keep you posted of any additional developments related to the scenario.
Please do not hesitate to contact me with any questions in the meantime.
I have created this support ticket for you regarding this matter - CAS-127749-K9R4G3.
After reviewing the matter further, I have asked our engineers to examine this map scenario in more detail. To ensure that it will receive attention, I have logged this behavior in our internal tracking system with a Development ID of 159898. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix, or other resolution.
I will leave this case open and update you with any available information. You can also continue to send updates to this case at any time.
You can view the status of the development issue connected to this case by selecting the "Development Issues" tab when viewing this case on the web site.
Please let me know if you need more information.
Thank you for your reply !
I have managed to reproduce the issue and am currently debugging the scenario to investigate possible causes. As a temporary solution, I would suggest defining thegeographicFromCenteredandcentrar_mapafunctions outside the scope of the document ready handler (so they are publicly visible) and calling them via a setTimeout call after the map is initialized:
setTimeout('centrar_mapa();',200)
I will keep you posted of any developments regarding this matter.
Do not hesitate to contact me with any comments or questions.
Im using 2013.2 versión of Ignite. I attach a test Project.