Spaces:
Runtime error
Runtime error
Commit
·
bf630df
1
Parent(s):
cb64a90
Add equator, tropic of capricorn/cancer to the map
Browse filesIn addition, changed the zoom to 2.5, i believe it automatically makes the zoom to 3 (step-up).
frontend/src/components/Map.js
CHANGED
|
@@ -288,6 +288,34 @@ const Map = ( { onMapClick, searchQuery, contentType } ) => {
|
|
| 288 |
}
|
| 289 |
}, [geoToolMode, areaPoints]);
|
| 290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
return (
|
| 292 |
<div ref={containerRef} style={{ display: 'flex', height: '100vh', width: '100%', overflow: 'hidden' }}>
|
| 293 |
{panelSize !== 'closed' && (
|
|
@@ -356,9 +384,11 @@ const Map = ( { onMapClick, searchQuery, contentType } ) => {
|
|
| 356 |
minWidth: 0,
|
| 357 |
overflow: 'hidden'
|
| 358 |
}}>
|
|
|
|
|
|
|
| 359 |
<MapContainer
|
| 360 |
center={markerPosition || [0, 0]} // Default center if no marker position
|
| 361 |
-
zoom={2}
|
| 362 |
style={{ height: '100%', width: '100%' }}
|
| 363 |
>
|
| 364 |
<ResizeHandler trigger={wikiWidth} />
|
|
@@ -366,6 +396,52 @@ const Map = ( { onMapClick, searchQuery, contentType } ) => {
|
|
| 366 |
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
| 367 |
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
| 368 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
<ClickHandler onClick={handleMapClick} />
|
| 370 |
{markerPosition && (
|
| 371 |
<Marker position={markerPosition}>
|
|
|
|
| 288 |
}
|
| 289 |
}, [geoToolMode, areaPoints]);
|
| 290 |
|
| 291 |
+
|
| 292 |
+
const wrapCount = 3;
|
| 293 |
+
|
| 294 |
+
const equatorLines = [];
|
| 295 |
+
for (let i = -wrapCount; i <= wrapCount; i++) {
|
| 296 |
+
const offset = i * 360;
|
| 297 |
+
equatorLines.push([
|
| 298 |
+
[0, -180 + offset],
|
| 299 |
+
[0, 180 + offset],
|
| 300 |
+
]);
|
| 301 |
+
}
|
| 302 |
+
const cancerLat = 23.4366;
|
| 303 |
+
const capricornLat = -23.4366;
|
| 304 |
+
const generateWrappedLine = (latitude) => {
|
| 305 |
+
const lines = [];
|
| 306 |
+
for (let i = -wrapCount; i <= wrapCount; i++) {
|
| 307 |
+
const offset = i * 360;
|
| 308 |
+
lines.push([
|
| 309 |
+
[latitude, -180 + offset],
|
| 310 |
+
[latitude, 180 + offset],
|
| 311 |
+
]);
|
| 312 |
+
}
|
| 313 |
+
return lines;
|
| 314 |
+
};
|
| 315 |
+
|
| 316 |
+
const tropicOfCancerLines = generateWrappedLine(cancerLat);
|
| 317 |
+
const tropicOfCapricornLines = generateWrappedLine(capricornLat);
|
| 318 |
+
|
| 319 |
return (
|
| 320 |
<div ref={containerRef} style={{ display: 'flex', height: '100vh', width: '100%', overflow: 'hidden' }}>
|
| 321 |
{panelSize !== 'closed' && (
|
|
|
|
| 384 |
minWidth: 0,
|
| 385 |
overflow: 'hidden'
|
| 386 |
}}>
|
| 387 |
+
|
| 388 |
+
|
| 389 |
<MapContainer
|
| 390 |
center={markerPosition || [0, 0]} // Default center if no marker position
|
| 391 |
+
zoom={2.5} //Originally 2
|
| 392 |
style={{ height: '100%', width: '100%' }}
|
| 393 |
>
|
| 394 |
<ResizeHandler trigger={wikiWidth} />
|
|
|
|
| 396 |
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
| 397 |
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
| 398 |
/>
|
| 399 |
+
|
| 400 |
+
{/* Tropics and Equator Lines */}
|
| 401 |
+
<>
|
| 402 |
+
{tropicOfCancerLines.map((line, idx) => (
|
| 403 |
+
<Polyline
|
| 404 |
+
key={`cancer-${idx}`}
|
| 405 |
+
positions={line}
|
| 406 |
+
pathOptions={{
|
| 407 |
+
color: 'gray',
|
| 408 |
+
weight: 1,
|
| 409 |
+
dashArray: '4, 4',
|
| 410 |
+
interactive: false,
|
| 411 |
+
}}
|
| 412 |
+
/>
|
| 413 |
+
))}
|
| 414 |
+
|
| 415 |
+
{tropicOfCapricornLines.map((line, idx) => (
|
| 416 |
+
<Polyline
|
| 417 |
+
key={`capricorn-${idx}`}
|
| 418 |
+
positions={line}
|
| 419 |
+
pathOptions={{
|
| 420 |
+
color: 'gray',
|
| 421 |
+
weight: 1,
|
| 422 |
+
dashArray: '4, 4',
|
| 423 |
+
interactive: false,
|
| 424 |
+
}}
|
| 425 |
+
/>
|
| 426 |
+
))}
|
| 427 |
+
</>
|
| 428 |
+
|
| 429 |
+
{/* Equator Lines */}
|
| 430 |
+
{equatorLines.map((line, idx) => (
|
| 431 |
+
<Polyline
|
| 432 |
+
key={`equator-${idx}`}
|
| 433 |
+
positions={line}
|
| 434 |
+
pathOptions={{
|
| 435 |
+
color: 'gray',
|
| 436 |
+
weight: 1.5,
|
| 437 |
+
dashArray: '6, 6',
|
| 438 |
+
interactive: false,
|
| 439 |
+
}}
|
| 440 |
+
/>
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
))}
|
| 444 |
+
|
| 445 |
<ClickHandler onClick={handleMapClick} />
|
| 446 |
{markerPosition && (
|
| 447 |
<Marker position={markerPosition}>
|