Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #!/usr/bin/bash
  2. # Fecha: 25 de septiembre de 2019
  3. # Descripcion: Convertir una tabla XLSX de puntos a rutas
  4.  
  5. for filename in *.xlsx;
  6. do
  7. archivo="${filename%.*}"
  8. echo "Construyendo los puntos a partir de la hoja de EXCEL $archivo"
  9.  
  10. ogr2ogr -f "GPKG" -geomfield geom -dialect sqlite -sql "SELECT *, GeomFromText('POINT Z(' || CAST( x AS integer) || ' ' || CAST( y AS integer) || ' ' || CAST (altitud AS integer) || ')', 3116 ) AS geom FROM Sheet1" --config OGR_XLSX_HEADERS FORCE $archivo.gpkg $archivo.xlsx
  11.  
  12. ogrinfo $archivo.gpkg -sql "ALTER TABLE SELECT RENAME TO vertices"
  13.  
  14. echo "Construyendo la ruta a partir de la capa de puntos"
  15.  
  16. ogr2ogr -update -dialect sqlite -sql "SELECT 'user_id', MakeLine(geom) FROM vertices GROUP BY 'user_id'" $archivo.gpkg $archivo.gpkg
  17.  
  18. ogrinfo $archivo.gpkg -sql "ALTER TABLE SELECT RENAME TO ruta"
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement