+ feat.geometry.type === 'Point' ||
+ feat.geometry.type === 'MultiPoint',
+ ),
+ }}
/>
-
)
diff --git a/client/src/pages/map/popups/Point.tsx b/client/src/pages/map/popups/Point.tsx
index b7afb9b1..1428f582 100644
--- a/client/src/pages/map/popups/Point.tsx
+++ b/client/src/pages/map/popups/Point.tsx
@@ -1,22 +1,55 @@
import * as React from 'react'
import geohash from 'ngeohash'
import { PopupProps } from '@assets/types'
+import { Button } from '@mui/material'
+import ExportRoute from '@components/dialogs/ExportRoute'
+import type { Feature } from 'geojson'
+import { useShapes } from '@hooks/useShapes'
interface Props extends PopupProps {
+ id: Feature['id']
lat: number
lon: number
+ properties: Feature['properties']
}
-export function PointPopup({ lat, lon }: Props) {
+export function PointPopup({ id, lat, lon, properties }: Props) {
+ const [open, setOpen] = React.useState('')
+
return (
+ {properties?.name && (
+ <>
+ Name: {properties.name}
+
+ >
+ )}
Lat: {lat.toFixed(6)}
Lng: {lon.toFixed(6)}
- Hash: {geohash.encode(lat, lon, 9)}
-
- Hash: {geohash.encode(lat, lon, 12)}
+ {process.env.NODE_ENV === 'development' && (
+ <>
+ Hash: {geohash.encode(lat, lon, 9)}
+
+ Hash: {geohash.encode(lat, lon, 12)}
+
+ >
+ )}
+
+ {open && (
+
+ )}
)
}
diff --git a/client/src/services/fetches.ts b/client/src/services/fetches.ts
index bc93041b..a4207c0e 100644
--- a/client/src/services/fetches.ts
+++ b/client/src/services/fetches.ts
@@ -164,9 +164,10 @@ export async function convert | object | string>(
area: ToConvert,
return_type: UsePersist['polygonExportMode'],
simplify: UsePersist['simplifyPolygons'],
+ url = '/api/v1/convert/data',
): Promise {
try {
- const data = await fetch('/api/v1/convert/data', {
+ const data = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
diff --git a/server/app/src/lib.rs b/server/app/src/lib.rs
index 4fa2658c..0e16078e 100644
--- a/server/app/src/lib.rs
+++ b/server/app/src/lib.rs
@@ -169,6 +169,7 @@ pub async fn main() -> io::Result<()> {
.service(
web::scope("/convert")
.service(routes::convert::convert_data)
+ .service(routes::convert::merge_points)
.service(routes::convert::simplify),
)
.service(
diff --git a/server/app/src/routes/convert.rs b/server/app/src/routes/convert.rs
index 8df18d0a..c71b897d 100644
--- a/server/app/src/routes/convert.rs
+++ b/server/app/src/routes/convert.rs
@@ -1,4 +1,6 @@
-use models::GeometryHelpers;
+use entity::sea_orm_active_enums::Type;
+use geojson::{Geometry, Value};
+use models::{GeometryHelpers, ToCollection, ToFeature};
use super::*;
@@ -42,3 +44,35 @@ async fn simplify(payload: web::Json) -> Result {
None,
))
}
+
+#[post("/merge_points")]
+async fn merge_points(payload: web::Json) -> Result {
+ let ArgsUnwrapped {
+ area, return_type, ..
+ } = payload.into_inner().init(Some("simplify"));
+
+ let mut new_multi_point: Vec> = vec![];
+
+ area.into_iter().for_each(|feat| {
+ if let Some(geometry) = feat.geometry {
+ match geometry.value {
+ Value::Point(point) => new_multi_point.push(point),
+ _ => {}
+ }
+ }
+ });
+
+ Ok(response::send(
+ Geometry {
+ bbox: None,
+ foreign_members: None,
+ value: Value::MultiPoint(new_multi_point),
+ }
+ .to_feature(Some(&Type::CirclePokemon))
+ .to_collection(None, None),
+ return_type,
+ None,
+ false,
+ None,
+ ))
+}