MapKit icon indicating copy to clipboard operation
MapKit copied to clipboard

Cannot modify default opening position on map

Open davegallant opened this issue 11 years ago • 12 comments

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,

davegallant avatar Dec 16 '13 15:12 davegallant

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.

adellamano avatar Jan 03 '14 17:01 adellamano

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.

tiendq avatar Apr 10 '14 09:04 tiendq

Do you want to change it after it's loaded or is not loading with the right position ?

imhotep avatar Aug 30 '14 00:08 imhotep

Having same problem. Any resolution on this?

jvence avatar Sep 17 '14 19:09 jvence

@jvence what problem?

imhotep avatar Sep 19 '14 15:09 imhotep

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

jvence avatar Sep 23 '14 12:09 jvence

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.

jvence avatar Sep 25 '14 07:09 jvence

Anyone know how to fix this? (@imhotep please refrain from saying "fix what?" ;-) )

jvence avatar Oct 03 '14 21:10 jvence

I will take a look at it this week-end

imhotep avatar Oct 03 '14 23:10 imhotep

Thanks @imhotep let me know if we can help.

jvence avatar Oct 06 '14 12:10 jvence

@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 avatar Oct 07 '14 17:10 jvence

@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

imhotep avatar Oct 07 '14 18:10 imhotep