code: public void addGeometryXYColumnAndIndex( String tableName, String geomColName, String geomType, String epsg,
              boolean avoidIndex ) throws Exception {
          String epsgStr = "4326";
          if (epsg != null) {
              epsgStr = epsg;
          }
          String geomTypeStr = "LINESTRING";
          if (geomType != null) {
              geomTypeStr = geomType;
          }
  
          if (geomColName == null) {
              geomColName = ASpatialDb.DEFAULT_GEOM_FIELD_NAME;
          }
  
          String _geomColName = geomColName;
          String _epsgStr = epsgStr;
          String _geomTypeStr = geomTypeStr;
          pgDb.execOnConnection(connection -> {
              try (IHMStatement stmt = connection.createStatement()) {
                  String sql = sqlTemplates.addGeometryColumn(tableName, _geomColName, _epsgStr, _geomTypeStr, "2");
                  stmt.execute(sql);
  
                  if (!avoidIndex) {
                      sql = sqlTemplates.createSpatialIndex(tableName, _geomColName);
                      stmt.execute(sql);
                  }
              }
              return null;
          });
  
      }
docs: Adds a geometry column to a table.
  
  @param tableName
  the table name.
  @param geomColName
  the geometry column name.
  @param geomType
  the geometry type (ex. LINESTRING);
  @param epsg
  the optional epsg code (default is 4326);
  @param avoidIndex if <code>true</code>, the index is not created.
  @throws Exception