Add pool location via click
This commit is contained in:
parent
f97e769d4b
commit
4577fda4a9
2 changed files with 18 additions and 9 deletions
|
|
@ -97,7 +97,7 @@ class MapArcgisTile extends HTMLElement {
|
||||||
detail: {
|
detail: {
|
||||||
lng: e.lngLat.lng,
|
lng: e.lngLat.lng,
|
||||||
lat: e.lngLat.lat,
|
lat: e.lngLat.lat,
|
||||||
map: this._map,
|
map: this,
|
||||||
point: e.point,
|
point: e.point,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,15 @@
|
||||||
<script src="https://unpkg.com/@esri/maplibre-arcgis@1.1.0/dist/umd/maplibre-arcgis.min.js"></script>
|
<script src="https://unpkg.com/@esri/maplibre-arcgis@1.1.0/dist/umd/maplibre-arcgis.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function updateSignalLocation(event) {
|
function updateSignalLocation(event, signal_id) {
|
||||||
console.log("map click", event.detail);
|
console.log("map click", signal_id, event.detail);
|
||||||
|
const map = event.detail.map;
|
||||||
|
const loc = {
|
||||||
|
latitude: event.detail.lat,
|
||||||
|
longitude: event.detail.lng,
|
||||||
|
};
|
||||||
|
map.SetMarkers([loc]);
|
||||||
|
this.poolLocations[signal_id] = loc;
|
||||||
}
|
}
|
||||||
// Return two points defining a bounding box for the given points
|
// Return two points defining a bounding box for the given points
|
||||||
function getBoundingBox(points) {
|
function getBoundingBox(points) {
|
||||||
|
|
@ -63,13 +70,14 @@
|
||||||
apiBase: "/api", // Change this to your API base URL
|
apiBase: "/api", // Change this to your API base URL
|
||||||
|
|
||||||
// State
|
// State
|
||||||
signals: [],
|
|
||||||
planFollowups: [],
|
|
||||||
leads: [],
|
|
||||||
selectedSignals: [],
|
|
||||||
loading: false,
|
|
||||||
creating: false,
|
creating: false,
|
||||||
error: null,
|
error: null,
|
||||||
|
planFollowups: [],
|
||||||
|
leads: [],
|
||||||
|
loading: false,
|
||||||
|
poolLocations: {}, // A mapping of signal IDs to the pool values
|
||||||
|
selectedSignals: [],
|
||||||
|
signals: [],
|
||||||
|
|
||||||
filters: {
|
filters: {
|
||||||
species: "",
|
species: "",
|
||||||
|
|
@ -183,6 +191,7 @@
|
||||||
// 'Authorization': `Bearer ${your_token}`
|
// 'Authorization': `Bearer ${your_token}`
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
pool_locations: this.poolLocations,
|
||||||
signal_ids: this.selectedSignals.map((s) => s.id),
|
signal_ids: this.selectedSignals.map((s) => s.id),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
@ -527,7 +536,7 @@
|
||||||
arcgis-access-token="{{ .C.ArcgisAccessToken }}"
|
arcgis-access-token="{{ .C.ArcgisAccessToken }}"
|
||||||
organization-id="{{ .Organization.ID }}"
|
organization-id="{{ .Organization.ID }}"
|
||||||
tegola="{{ .URL.Tegola }}"
|
tegola="{{ .URL.Tegola }}"
|
||||||
@map-click="updateSignalLocation($event)"
|
@map-click="updateSignalLocation($event, signal.id)"
|
||||||
:latitude="signal.location.latitude"
|
:latitude="signal.location.latitude"
|
||||||
:longitude="signal.location.longitude"
|
:longitude="signal.location.longitude"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue