MapKit
MapKit copied to clipboard
Cannot modify default opening position on map
I've got the map embedded on iOS but cannot change the default location.
I tried changing (in MapKit.js)
var MapKit = function() { this.options = { height: 260, diameter: 1000, atBottom: true, lat: 33.281468, lon: -71.104446 };
the lat and lon to different values but the map always opens to the same location.
What am I doing wrong here?
Cheers,
I modified the showMap function in MapKit.js:
showMap: function(success, error, options) { for (var v in options) { if (options.hasOwnProperty(v)) { this.options[v] = options[v]; } } cordovaRef.exec(success, error, 'MapKit', 'showMap', [this.options]); }
Then passed in a new options object with updated params and have it working successfully.
Map is centered on the first call and being reused in next calls so it doesn't update to new location. Look at showMap method (Objective-C code) for detail. You need to update this method.
Do you want to change it after it's loaded or is not loading with the right position ?
Having same problem. Any resolution on this?
@jvence what problem?
After the map is drawn, if you redraw it second time with a new location, it ignores the new location (not pin location but the map center location) - See Tiendq's comment above
We basically want to be able to change the location of the map after the first redraw. The first time it's drawn with the correct location but subsequent calls to draw a map, do not update the location and always uses the first location drawn.
Anyone know how to fix this? (@imhotep please refrain from saying "fix what?" ;-) )
I will take a look at it this week-end
Thanks @imhotep let me know if we can help.
@adellamano tried your solution to no avail. Can you elaborate more on how you got it working using the javascript solution you posted above?
@jvence There is a pending pull request https://github.com/imhotep/MapKit/pull/56
Maybe you can give it a try? It only works for iOS though for now