🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
6.4 KiB
Info Layers Test Results - Map ID 16950
Test Date: 2025-12-09 Test Layers: parcels, cabinet_boundaries, cables Test Type: First 10 records per layer (3 for boundaries/parcels, 3 for cables in actual shapefile) Map ID: 16950
Summary
| Layer | Records Attempted | Records Uploaded | Status |
|---|---|---|---|
| cabinet_boundaries.shp | 3 | 0 | ❌ API Error |
| cables.shp | 3 | 0 | ❌ API Error |
| parcels.shp | 3 | 0 | ❌ API Error |
Overall: 0 out of 9 records uploaded (0% success rate)
Progress Made
✅ Metric Field Calculation Working
The metric field is now being calculated correctly:
Cables (LineString):
{
"metric": "Mileage: 0.9196; Footage: 4856"
}
Boundaries & Parcels (Polygon):
{
"metric": "Square Miles: 3.3141"
}
Formula Used:
- Lines: At 40° latitude, 1° longitude ≈ 53 miles, 1° latitude ≈ 69 miles
- Polygons: At 40° latitude, 1 degree² ≈ 3,657 square miles
Code Added:
_calculate_line_metric()- Line length calculation_calculate_polygon_metric()- Polygon area calculation
Current Blocker
❌ API Error: Field 'data' doesn't have a default value
Error Message:
Database Exception: SQLSTATE[HY000]: General error: 1364
Field 'data' doesn't have a default value
The SQL being executed was: INSERT INTO `mapobject` (`mapprojectId`, `name`, ...
What We Tried:
-
Attempt 1: Send
dataas nested array of lat/lng objects- Result: ❌ Same error
-
Attempt 2: JSON-encode
datafield as a string- Result: ❌ Same error
Example Data Being Sent:
{
"mapProjectId": 16950,
"name": "Zone 01 Boundary",
"mapinfoobjecttypeId": 3,
"data": "[{\"lat\": 40.7723..., \"lng\": -124.1857...}, ...]",
"color": "#ffffff",
"alpha": "0.40",
"metric": "Square Miles: 3.3141"
}
Analysis
Root Cause
The error message "Field 'data' doesn't have a default value" is a MySQL database error, not a validation error. This indicates:
- The Verofy API backend is attempting to INSERT into the
mapobjecttable - The
datafield we're sending is not being included in the INSERT statement - The database column
datahas no default value, causing the query to fail
Possible Reasons
1. API Endpoint Not Fully Implemented
The /map-info-object/create endpoint may not properly handle the data field during creation.
2. Missing Required Field
There may be another field we need to send that tells the API how to interpret the data field.
3. Field Name Different for Creation
The field might be named differently when creating vs reading:
- Reading:
data(from GET/map-info-object/{id}) - Creating:
???(for POST/map-info-object/create)
4. Data Format Issue
The data field might need a different structure than what we see in GET responses.
Comparison with Export
From Map 15685 Export (GET response):
Type 2 (Polyline/Cable):
{
"mapinfoobjecttypeId": 2,
"data": [
{"lat": 40.760037779, "lng": -124.174677888},
{"lat": 40.760068861, "lng": -124.171780846}
]
}
Type 3 (Polygon):
{
"mapinfoobjecttypeId": 3,
"data": [
{"lat": 40.761573196, "lng": -124.17190395},
{"lat": 40.760796168, "lng": -124.173069332},
...
]
}
What We're Sending (POST request):
Exactly the same format - but API is not accepting it.
Recommendations
Option 1: Contact Verofy API Support
This appears to be an API bug or undocumented requirement. We should ask:
- Is the
/map-info-object/createendpoint fully implemented? - What is the correct format for the
datafield when creating info objects? - Are there any required fields beyond what's documented?
Option 2: Test with Manual Web Interface
Create an info object manually through Verofy's web interface, then:
- Retrieve it via GET
/map-info-object/{id} - Compare the structure
- Look for any additional fields that were set
Option 3: Alternative Approach
If info objects can't be created via API, we may need to:
- Skip these layers for now
- Import them manually through Verofy's web interface
- Wait for API endpoint to be fixed
Code Changes Made
File: /home/ahall/Sandbox/dragnddrop/backend/verofy_uploader.py
Lines 131-170: Added metric calculation functions
def _calculate_line_metric(self, geometry) -> str:
"""Calculate mileage and footage for cable lines"""
# Implementation...
def _calculate_polygon_metric(self, geometry) -> str:
"""Calculate square miles for boundaries and parcels"""
# Implementation...
Lines 663-675: Updated _upload_cabinet_boundaries()
metric = self._calculate_polygon_metric(row.geometry)
info_data = {
...
"metric": metric
}
Lines 709-721: Updated _upload_cables()
metric = self._calculate_line_metric(row.geometry)
info_data = {
...
"metric": metric
}
Lines 756-768: Updated _upload_parcels()
metric = self._calculate_polygon_metric(row.geometry)
info_data = {
...
"metric": metric
}
Lines 958-986: Updated _create_info_object()
# JSON-encode the data field as a string (API may expect this)
if 'data' in info_data:
info_data_copy = info_data.copy()
info_data_copy['data'] = json.dumps(info_data['data'])
# Send encoded version...
Next Steps
-
Document the API Issue
- Report to Verofy API team
- Provide exact error message and request/response details
-
Test Alternative Approaches
- Try different field names (
dataAsText,geometry, etc.) - Try sending data without JSON encoding
- Try minimal payload to see what works
- Try different field names (
-
Verify Endpoint Status
- Check if endpoint is in beta/deprecated
- Look for alternative endpoints for info objects
-
Focus on Working Layers
- Continue with poles, segments, sites (working)
- Fix access_points, network_elements, splicing
- Come back to info layers once API issue is resolved
Test Data
Successfully Calculated Metrics
Cabinet Boundary "Zone 01":
- Area: 3.3141 square miles
- 6 coordinate points
Cable "144F/EUR_Z07_DC_001":
- Length: 0.9196 miles (4,856 feet)
- 2 coordinate points
Parcel (Zone 01):
- Area: 0.1362 square miles
- 5 coordinate points (closed polygon)
All metric calculations are working correctly and match expected format from Verofy exports.