zhuorantan / LocationPicker

A ready for use and fully customizable location picker for your app
MIT License
400 stars 79 forks source link

Map moves automatically #12

Closed ashish-naik closed 8 years ago

ashish-naik commented 8 years ago

Hi,

I find LocationPicker very easy to use however facing an issue.

The place mark moves randomly. Please see attached. How to fix this? map3

Thanks Ashish

zhuorantan commented 8 years ago

Hi,

That's weird. Does this happen for any location?

ashish-naik commented 8 years ago

Yes for all locations.

zhuorantan commented 8 years ago

Try removing the use of func gcj2wgs in line 1005 of file LocationPicker.swift:

replace let revisedCoordinate = gcj2wgs(mapView.centerCoordinate) with let revisedCoordinate = mapView.centerCoordinate

ashish-naik commented 8 years ago

I am using pods. won't it get overwritten if I refresh the code later?

zhuorantan commented 8 years ago

I just want to make sure if this is what causes the problem. I will fix the issue and release an update.

ashish-naik commented 8 years ago

better but still jumping a little. Pls see the screenshot map5

zhuorantan commented 8 years ago

Clearly the screenshots were taken on simulator, have you tried on devices? Are you using iOS 10 SDK?

ashish-naik commented 8 years ago

No I am on iOS 9. Will try on device in the evening and report back.

Thanks.

ashish-naik commented 8 years ago

Ran on iPhone 6. Result is similar to previous gif.

However, sometimes jumps are bigger as shown in first gif.

zhuorantan commented 8 years ago

It seems that maybe Apple has updated it's map server. So when it received a reverse-geocoding request, it always return a nearby location even if it's quite a long distance away. I added a new Bool value var isRedirectToExactCoordinate, default is true. If you don't want to be redirected, just set it to false. Upgrade to version 2.0.0 and you can find it.

ashish-naik commented 8 years ago

Okay thanks. Appreciate your response and fix. On Sat, Aug 6, 2016 at 7:26 AM Jerome Tan notifications@github.com wrote:

It seems that maybe Apple has updated it's map server. So when it received a reverse-geocoding request, it always return a nearby location even if it's quite a long distance away. I added a new Bool value var isRedirectToExactCoordinate, default is true. If you don't want to be redirected, just set it to false. Upgrade to version 2.0.0 and you can find it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JeromeTan1997/LocationPicker/issues/12#issuecomment-237999877, or mute the thread https://github.com/notifications/unsubscribe-auth/AEtS5PBlukM1_WRUJQbuyIprLFCVJX64ks5qc-nrgaJpZM4Jc8cY .

Regards, Ashish

ashish-naik commented 8 years ago

Hi Jerome,

I am not able to update 2.0.0 using pod file. getting below error.

[!] Unable to satisfy the following requirements: - LocationPickerViewController (~> 2.0.0) required by Podfile

my pod file has below line. pod 'LocationPickerViewController', '~> 2.0.0'

and below output of pod search LocationPickerViewController

-> LocationPickerViewController (1.2.0) A ready for use and fully customizable location picker for your app. pod 'LocationPickerViewController', '~> 1.2.0'

zhuorantan commented 8 years ago

Sorry, I'm still trying to push the pod. My Cocoapods client is experiencing an issue with Xcode 8 beta 4. A workaround is changing the Podfile to pod 'LocationPickerViewController', '~> 2.0.0', git: 'https://github.com/JeromeTan1997/LocationPicker.git'

ashish-naik commented 8 years ago

Okay thanks.

ashish-naik commented 8 years ago

Hi Jerome,

This is still not working unfortunately. Showing same behaviour. Below is my code

I checked on iphone 6 and simulator both.

` func pickLocation(sender: AnyObject) {

    let customLocationPicker = CustomLocationPicker()
    customLocationPicker.viewController = self
    customLocationPicker.mapViewZoomEnabled = true
    customLocationPicker.isRedirectToExactCoordinate = false

    let navigationController = UINavigationController(rootViewController: customLocationPicker)
    presentViewController(navigationController, animated: true, completion: nil)

}`
zhuorantan commented 8 years ago

I did some research and found that India also adopts a different coordinate system from the standard WGS84. I only adjusted the coordinate for China which adopts GCJ02. I believe you will have to find how to transform your country's coordinate system to WGS84. Apple has transformed the coordinate system for China in iOS 10, you can try it to see whether the problem solved.

ashish-naik commented 8 years ago

Okay thanks

arno608rw commented 8 years ago

I have the same problem and i use .isRedirectToExactCoordinate = false;

test

arno608rw commented 8 years ago

@ashish-naik Please tell me how to solve

ashish-naik commented 8 years ago

No i couldn't solve it and parked it for time being. Pls try Jerome's suggestion. Hope you find the solution.