Well, I have an image of a floor. What I need to do is get the user’s current location and display it on the floor image. I know that I need to convert the lat and lon to pixels and point it on the custom map.
I followed this Convert GPS coordinates to coordinate plane. But I couldn’t get it properly. Not even close. May be its because, the area of the building is small (Wonder whether it could be developed for small area). And I looked up on some other question. Its merely hard-coding. I don’t want to do it.
So It would be helpful if somebody provide me any logical ideas or code samples or tutorials. Anything would be fine. Thanks in advance!! :-)
lat = 12.875538;
longitudeVal = 80.227112;
delta_lat = 0.0001; // Adjust Y
delta_long = 0.0001; // Adjust X
/* length */ delta_x = 130; // 130
/* width */ delta_y = 70; // 70
vertical_scale = delta_y/delta_lat;
horizontal_scale = delta_x/(cos(lat)*delta_long);
/* lati */ x = (6378.1 * (1+sin(lat))/cos(lat));
/* long */ y = (6378.1 * longitudeVal);
x = x / horizontal_scale;
y = y / vertical_scale;
/* y = ((-1 * lat) + 90) * (delta_x / 180);
x = (longitudeVal + 180) * (delta_y / 360);*/
NSLog(@"lat %f long %f x %d y %d",lat,longitudeVal,x,y);