| 1234567891011121314151617181920212223242526 |
- # 测试现有SHP文件解析
- $shpPath = "d:\Web\PlatformModel\ruoyi-admin\uploads\models\geojson\803381497aa04afe943bb0a04a6ac30c\流域.shp"
- $url = "http://localhost:8448/cesium/geojson/upload"
- # 读取SHP文件
- $shpFileBytes = [System.IO.File]::ReadAllBytes($shpPath)
- $shpFileName = [System.IO.Path]::GetFileName($shpPath)
- # 尝试调用上传接口
- $boundary = [System.Guid]::NewGuid().ToString()
- $body = @"
- --$boundary
- Content-Disposition: form-data; name="file"; filename="$shpFileName"
- Content-Type: application/octet-stream
- $( [System.Text.Encoding]::UTF8.GetString($shpFileBytes) )
- --$boundary--
- "@
- try {
- $response = Invoke-RestMethod -Uri $url -Method Post -Body $body -ContentType "multipart/form-data; boundary=$boundary" -TimeoutSec 60
- Write-Host "Response: $($response | ConvertTo-Json)"
- } catch {
- Write-Host "Error: $_"
- Write-Host $_.Exception.Response
- }
|