Update from Sync Service
This commit is contained in:
52
附件/2026/个人知识库/数据库/回补中间一段时间的GNSS数据.md
Executable file
52
附件/2026/个人知识库/数据库/回补中间一段时间的GNSS数据.md
Executable file
@@ -0,0 +1,52 @@
|
||||
```sql
|
||||
declare @dt datetime --时间
|
||||
declare @gpsindex numeric(18,2) --GPSIndex
|
||||
declare @rand float --随机数
|
||||
declare @count int --计数
|
||||
```
|
||||
--declare @GPSINDEX1 bigint
|
||||
```sql
|
||||
declare @adatetime1 datetime
|
||||
declare @endDate datetime; --结束时间
|
||||
declare @X1 float
|
||||
declare @Y1 float
|
||||
declare @H1 float
|
||||
declare @DX1 float
|
||||
declare @DY1 float
|
||||
declare @DH1 float
|
||||
declare @X0 float
|
||||
declare @Y0 float
|
||||
declare @H0 float
|
||||
|
||||
set @dt = '2020-1-17 12:30:00.000';
|
||||
set @endDate= '2020-5-18 18:00:00.000';
|
||||
select top 1 @X1 = X,@Y1 = Y,@H1 = Height,@DX1=dltaX,@DY1=dltaY,@DH1=dltaH from DC_GB09_STC where aDatetime < @dt order by aDatetime desc
|
||||
```
|
||||
--求出基准坐标
|
||||
```sql
|
||||
set @X0=@X1-@DX1
|
||||
set @Y0=@Y1-@DY1
|
||||
set @H0=@H1-@DH1
|
||||
select @X0,@Y0,@H0
|
||||
```
|
||||
while(@dt < @endDate) begin
|
||||
|
||||
```sql
|
||||
set @gpsindex = convert(bigint, datediff(ss, '1970-01-01 00:00:00', @dt))*1000 + datepart(ms,@dt)
|
||||
SET @DX1 = RAND()*8-8/2;
|
||||
SET @DY1 = RAND()*8-8/2;
|
||||
SET @DH1 = RAND()*10-10/2;
|
||||
SET @X1 = @X0+ @DX1/1000
|
||||
SET @Y1 = @Y0+ @DY1/1000
|
||||
SET @H1 = @H1+ @DH1/1000
|
||||
SET @adatetime1 = DATEADD(S,@gpsindex/1000,'1970-01-01 00:00:00')
|
||||
BEGIN TRY insert into DC_GB09_STC([GPSIndex],[aDatetime],[X],[Y],[Height],[dltaX],[dltaY],[dltaH])VALUES(@gpsindex,@adatetime1,@X1,@Y1,@H1,@DX1,@DY1,@DH1)
|
||||
END TRY BEGIN
|
||||
```
|
||||
CATCH END CATCH
|
||||
--****************
|
||||
```sql
|
||||
set @count = @count + 1
|
||||
set @dt = DATEADD(MINUTE,30,@dt) --每次递增5min
|
||||
```
|
||||
end
|
||||
Reference in New Issue
Block a user