fix map and stuff
This commit is contained in:
@@ -355,9 +355,27 @@ const PropertyMap = ({
|
||||
|
||||
{/* Existing sections */}
|
||||
{sections.map((section) => {
|
||||
if (!section.polygonData?.coordinates?.[0]) return null;
|
||||
console.log('Section:', section);
|
||||
|
||||
// Handle both string and object polygon data
|
||||
let polygonData = section.polygonData;
|
||||
if (typeof polygonData === 'string') {
|
||||
try {
|
||||
polygonData = JSON.parse(polygonData);
|
||||
} catch (e) {
|
||||
console.error('Failed to parse polygon data:', e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (!polygonData?.coordinates?.[0]) {
|
||||
console.log('No coordinates found for section:', section.id);
|
||||
return null;
|
||||
}
|
||||
|
||||
const coordinates = polygonData.coordinates[0].map(([lng, lat]) => [lat, lng]);
|
||||
console.log('Mapped coordinates:', coordinates);
|
||||
|
||||
const coordinates = section.polygonData.coordinates[0].map(([lng, lat]) => [lat, lng]);
|
||||
const isInternallySelected = selectedSection?.id === section.id;
|
||||
const isExternallySelected = selectedSections.includes(section.id);
|
||||
const isSelected = isInternallySelected || isExternallySelected;
|
||||
|
||||
Reference in New Issue
Block a user