Wrong orientation of Parkings

pull/36/head untagged-a489b140ad54970a8938
portree_kid 5 years ago
parent 62823feedd
commit fe1db57414

@ -12,7 +12,7 @@ L.ParkingSpot = L.Circle.extend({
var start = this._latlng;
var options = { units: 'kilometers' };
var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading - 180, options);
var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading, options);
// Resize, since leaflet is wrong
var rad2 = start.distanceTo(this.turfToLatLng(end), options);
console.debug('Dist ', start, [start.lng, start.lat], end.geometry.coordinates, this.options.attributes.radius, rad2);
@ -63,7 +63,7 @@ L.ParkingSpot = L.Circle.extend({
if (this.editEnabled()) {
var start = this._latlng;
var options = { units: 'kilometers' };
var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading - 180, options);
var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading, options);
// Resize, since leaflet is wrong
var rad2 = start.distanceTo(this.turfToLatLng(end), options);
this.setRadius(rad2);
@ -78,7 +78,7 @@ L.ParkingSpot = L.Circle.extend({
var start = this._latlng;
var end = this.editor._resizeLatLng.__vertex.getLatLng();
var heading = turf.bearing([start.lng, start.lat], [end.lng, end.lat]);
this.options.attributes.heading = heading + 180;
this.options.attributes.heading = heading;
const counts = [7.5, 12, 18, 26, 32.5, 40];
const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev);

@ -107,7 +107,7 @@ var mapParkings = function (o) {
var lat = convertLat(o.getLatLng());
var lon = convertLon(o.getLatLng());
// <Parking index="0" type="gate" name="GA_Parking" lat="S9 25.739923" lon="E160 2.927602" heading="67" radius="44" airlineCodes="" />
return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading), '@radius': String(o.options.attributes.radius) };
return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading+180), '@radius': String(o.options.attributes.radius) };
}
}

Loading…
Cancel
Save