Commit 48c4b6dd by Adarsh K

latitude mistakes

parent f40def8a
......@@ -144,6 +144,7 @@ export class AppComponent {
'review'
];
const currentUrl = this.router.url.split('/');
console.log(currentUrl);
const index = restrictedUrl.findIndex(x => x === currentUrl[1]);
// console.log(currentUrl[1], index, this.state);
if (index > -1 || this.tabData === false) {
......
......@@ -125,8 +125,8 @@ export class HomePage implements OnInit {
this.address = address.address;
console.log(address.latLng);
this.centerService.getNearBy(
address.latLng._lat,
address.latLng._long,
address.latLng.latitude,
address.latLng.longitude,
this.service.distance
);
this.loader = false;
......
......@@ -141,7 +141,7 @@
}
.ellipse {
white-space: nowrap;
width: 180px;
width: 150px;
overflow: hidden;
text-overflow: ellipsis;
}
......
......@@ -51,8 +51,8 @@ export class TrackorderPage implements OnInit {
getDirection() {
this.order = this.myorder.selItem;
this.origin = { lat: this.order.pickupLocation._lat, lng: this.order.pickupLocation._long };
this.destination = { lat: this.order.deliveryLocation._lat, lng: this.order.deliveryLocation._long };
this.origin = { lat: this.order.pickupLocation.latitude, lng: this.order.pickupLocation.longitude };
this.destination = { lat: this.order.deliveryLocation.latitude, lng: this.order.deliveryLocation.longitude };
this.renderOptions = { polylineOptions: { strokeColor: 'rgba(69, 67, 152,1)' }, suppressMarkers: true };
this.markerOptions = {
origin: {
......
......@@ -137,7 +137,7 @@ export class AddressService {
public async getNearBy(centerId, userId, distance) {
// latitude, longitude, distance, userId
console.log(centerId);
console.log(centerId, userId, distance);
if (centerId) {
this.afs.collection('centers').doc(centerId).ref.get().then((doc) => {
if (doc.exists) {
......@@ -145,8 +145,7 @@ export class AddressService {
const center = doc.data();
const This = this;
const state = true;
const latitude = center.latLng._lat;
const longitude = center.latLng._long;
this.centerLoc = {
cId: center.cId,
centerImg: center.centerImg,
......@@ -157,17 +156,23 @@ export class AddressService {
location: center.location,
status: center.status
};
console.log(this.centerLoc);
const latitude = center.latLng.latitude;
const longitude = center.latLng.longitude;
const lat = 0.0144927536231884;
const lon = 0.0181818181818182;
console.log(latitude + ' - ' + lat + ' * ' + distance);
const lowerLat = latitude - lat * distance;
const lowerLon = longitude - lon * distance;
const greaterLat = latitude + lat * distance;
const greaterLon = longitude + lon * distance;
console.log(lowerLat, lowerLon, greaterLat, greaterLon);
const lesserGeopoint = new firebase.firestore.GeoPoint(lowerLat, lowerLon);
const greaterGeopoint = new firebase.firestore.GeoPoint(
greaterLat,
......
......@@ -140,7 +140,7 @@ export class OrdersService {
const promise = new Promise(resolve => {
distinctShops.forEach(item => {
console.log(item);
const pickup = new firebase.firestore.GeoPoint(centerLoc.latLng._lat, centerLoc.latLng._long);
const pickup = new firebase.firestore.GeoPoint(centerLoc.latLng.longitude, centerLoc.latLng.longitude);
const products = {};
const cartItem = cartGroup[item];
let prodPrice = 0;
......
......@@ -23,9 +23,9 @@ export class ProductsService {
this.fav = [];
this.prodSlideImg = [];
this.service.get('userData').then(data => {
console.log(data);
this.user = JSON.parse(data);
this.getFavlist(this.user.id);
console.log(this.user);
// this.getFavlist(this.user.uid);
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment