Commit 48c4b6dd by Adarsh K

latitude mistakes

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